ó
’™xTc           @   s›   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z d  d l m Z m	 Z	 d „  Z
 d „  Z d Z e d k r— e
 e j d	 ƒ d
 GHn  d S(   iÿÿÿÿ(   t   divisionN(   t   easy_run(   t   open_tmp_filet   open_tmp_directoryc         C   s`   t  d d ƒ } t j j t j j ƒ } t j t j j | ƒ ƒ z t ƒ  Wd  t j | ƒ Xd  S(   Nt   suffixt   example_cif_parser(   R   t   ost   patht   abspatht   curdirt   chdirt   exercise_compilation(   t   argst   tmp_dirt   cur_dir(    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/cif/tests/tst_ucif_examples_compilation.pyt   run   s    c          C   s9  t  j j d d ƒ }  t  j j d d ƒ } |  t j d <| t j d <|  j d ƒ d k  s_ t ‚ t j	 d k r� d	 |  } d
 } n d |  } d } t
 j | ƒ } t j j d | ƒ s¼ t ‚ t d d ƒ } | j t ƒ | j ƒ  d | j } t j j d | ƒ } t
 j | ƒ j ƒ  } | j d j d ƒ s5t ‚ d  S(   Nt   module_namet   ucift   antlr3t   LIBTBX_UCIFt   LIBTBX_ANTLR3t   "i    t   win32s"   "%s/examples/build_cif_parser.bat"s   .exes(   source "%s/examples/build_cif_parser.sh"t    t
   cif_parserR   s   .cifs   cif_parser "%s"t   .s   Congratulations!(   t   libtbxt   envt	   dist_patht
   under_distR   t   environt   findt   AssertionErrort   syst   platformR   t   fully_bufferedR   t   existsR   t   writet
   cif_stringt   closet   namet   joint   raise_if_errorst   stdout_linest
   startswith(   t	   ucif_distt   antlr3_distt   cmdt   extt   resultt   ft   r(    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/cif/tests/tst_ucif_examples_compilation.pyR      s&    
	

s   data_a
_a 1
_b 2
t   __main__i   t   OK(   t
   __future__R    R   R!   t   libtbx.load_envR   R   t   libtbx.test_utilsR   R   R   R   R&   t   __name__t   argv(    (    (    s[   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/iotbx/cif/tests/tst_ucif_examples_compilation.pyt   <module>   s   			