ó
Ý™xTc           @   sµ   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 d „  Z
 d „  Z e d k r± e e j ƒ d k s� t ‚ e e j d ƒ n  d S(   iÿÿÿÿ(   t   divisionNc      	      sñ  |  \ } } t  } g  } x¦| D]ž} | j ƒ  ‰ ‡  ‡ f d †  } | d d ƒ s | d d ƒ s | d d ƒ rv q n  | j | ƒ ˆ j d ƒ r˜ q n  ˆ d k rª q n  ˆ j d	 ƒ r¿ q n  ˆ j d
 ƒ rã t j d k rã q n  x× d d d d d d d d g D] }	 ˆ j |	 ƒ rPqqWt j j	 ˆ  | ƒ }
 t j j
 |
 ƒ rLq n  xn | D]" } t j | |
 ƒ d  k	 rSPqSqSWt j j	 | |
 ƒ } | r­t j j | ƒ t } n  t j |
 | ƒ q Wt | ƒ t | ƒ k rí| 2| j | ƒ n  d  S(   Nc            s`   |  ˆ k r t  St j j ˆ  ˆ ƒ } t j j | ƒ s; t  St j j | | ƒ } t j j | ƒ S(   N(   t   Falset   ost   patht   joint   isdirt   isfile(   t   sub_dirt   file_in_subdirR   (   t   dirnamet   name(    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/bundle/copy_runtime_sources.pyt   name_is_sub_dir_with_file   s      t   cvst   Entriess   .svns
   README.txtt   entriest   .t
   sconscriptt   makefiles   .exet   nts   .pycs   .pyos   .hs   .cs   .hpps   .cpps   .ccs   .f(   t   Truet   lowert   appendt
   startswitht   endswithR   R
   t   libtbxR   t	   norm_joinR   t   ret   searcht   Nonet   create_target_dirR   t   shutilt   copyt   lent   extend(   t   .0R	   t   namest   exclude_from_binary_bundlet	   dist_copyR   t
   names_keept	   file_nameR   t   extt   srct   patternt   dest(    (   R	   R
   sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/bundle/copy_runtime_sources.pyt   copy_dist_files	   sH    	    % 	c         C   sí   t  j ƒ  } t  j j t  j j |  ƒ ƒ } xœ t j j D]Ž } x… | j ƒ  D]w \ } } | d k rh qJ n  t	 | ƒ } t j j
 | t  j j | ƒ ƒ } t  j | ƒ t  j j d t | j | f ƒ qJ Wq7 Wt j j j | ƒ t  j | ƒ d  S(   Nt   boostR   (   R   t   getcwdR   t   normpatht   abspathR   t   envt   module_listt   name_and_dist_path_pairst   absR   t   basenamet   chdirt   walkR,   R$   t   bundlet   utilst   write_bundle_info(   t   target_roott   cwdt   abs_target_roott   moduleR
   t	   dist_pathR%   (    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/bundle/copy_runtime_sources.pyt   run0   s     		t   __main__i   i   (   t
   __future__R    t   libtbx.bundle.utilsR   t   libtbx.load_envt   libtbx.pathR   R   t   sysR   R,   R@   t   __name__R    t   argvt   AssertionError(    (    (    sP   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/bundle/copy_runtime_sources.pyt   <module>   s   	'	