ó
çxTc           @   są   d  d l  m Z d  d l Z d  d l Z d  d l Z d   Z d   Z e d k r­ e j d d k ro e   q­ e j d d k r e j	 e    q­ d	 e j
 j e  GHn  d S(
   i˙˙˙˙(   t   divisionNc          C   sš  d d  l  }  d d l m } d d l m } HHd d GHt j d t j t j	 t j
 Bt j B } d | j   GHHd |  j j j   GH|  j j j   Hd d GHx' d D] } | j d |  j d GHqŚ Wd d GHt j t j d  t j d j   t j d )t j j d  rat j d j   } t j j g  | D] } d | ^ q5 d d j |  GHnJ t j j d  rŤt j d j   } t j j |  d d j |  GHn  | j   d  S(   Ni˙˙˙˙(   t   easy_run(   t   sconst   -iP   s8   ^(\d+ \. \d+ \. \d+) .*? \[\s*GCC\s* (\d+ \. \d+ \. \d+)s    Python %s (compiled with gcc %s)s   ** %s **t   gcct   clangs   type %si    t   XCODE_CCTBX_BUILDt   XCODE_SCONS_OPTIONSi   t   XCODE_SCONS_LIB_TARGETs	   lib/%s.sos%   warning: only library being built: %ss   , t   XCODE_SCONS_PROGRAM_TARGETs%   warning: only program being built: %s(   R   R   (   t   libtbx.load_envt   libtbxR   t   libtbx.command_lineR   t   ret   searcht   syst   versiont   Xt   Mt   St   groupst   envt
   build_patht   basenamet   build_optionst   reportt   fully_bufferedt   stdout_linest   ost   chdirt   environt   splitt   argvt   gett   extendt   joint   run(   R   R   R   t   mt   compilert   libst   libt   programs(    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/development/xcode_build_phase.pyt	   run_scons   s:      				'c          C   s  d d  l  }  d d  l } | j d t |  j j  d t d g d | j d | j } t	 j
 d t	 j  } t |  j j  d } xo | j D]d } | j |  } | rŃ | j d	  j d  rŃ t j j |  n  t j j |  t j j   q W| j   | j S(
   Ni˙˙˙˙s   %s/libtbx.pythons   -ut   childt   stdoutt   stderrs   ^(.*? : \d* : \d* : \s* error:)t   /i   (   R
   t
   subprocesst   Popent   absR   t   bin_patht   __file__t   PIPEt   STDOUTR   t   compileR   R   R,   R   t   groupt
   startswithR   t   writet   flusht   waitt
   returncode(   R   R/   t   proct	   error_patt   prefixt   liR%   (    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/development/xcode_build_phase.pyt   run_filtered_scons&   s    
t   __main__i   R+   t   parents   Usage: %s [child|parent](   t
   __future__R    R   R   R   R*   RA   t   __name__R    t   exitt   pathR   R3   (    (    (    sR   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/development/xcode_build_phase.pyt   <module>   s   $	"	
