ó
|G–Rc           @   sà  d  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 y# d d l	 m
 Z
 m Z d „  Z Wn0 e k
 r¥ d d l m Z m Z d „  Z n Xd d	 l m Z d d
 l m Z d d l m Z m Z m Z d d l m Z d d l m Z d d l m Z m Z d d l m Z d „  Z  d „  Z! d Z" d e f d „  ƒ  YZ# e$ j% d j& ƒ  ƒ Z' d „  Z( d „  Z) d „  Z* i d e+ 6d e, 6Z- d „  Z. d „  Z/ d „  Z0 d d d  d! g Z1 d" d" e2 d# d$ „ Z3 d S(%   s6   setuptools.command.bdist_egg

Build .egg distributionsiÿÿÿÿN(   t   Command(   t   remove_treet   mkpath(   t   get_patht   get_python_versionc           C   s
   t  d ƒ S(   Nt   purelib(   R   (    (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt   _get_purelib   s    (   t   get_python_libR   c           C   s
   t  t ƒ S(   N(   R   t   False(    (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR      s    (   t   log(   t   DistutilsSetupError(   t   get_build_platformt   Distributiont   ensure_directory(   t
   EntryPoint(   t   CodeType(   t
   basestringt   next(   t   Libraryc         C   sE   d |  k r% t  j j |  ƒ d }  n  |  j d ƒ rA |  d  }  n  |  S(   Nt   .i    t   moduleiúÿÿÿ(   t   ost   patht   splitextt   endswith(   t   filename(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt   strip_module   s
    c      
   C   sO   t  | d ƒ } | j d j d d d d |  d d d	 d
 g ƒ ƒ | j ƒ  d  S(   Nt   ws   
s   def __bootstrap__():s-      global __bootstrap__, __loader__, __file__s!      import sys, pkg_resources, imps:      __file__ = pkg_resources.resource_filename(__name__,%r)s3      __loader__ = None; del __bootstrap__, __loader__s&      imp.load_dynamic(__name__,__file__)s   __bootstrap__()t    (   t   opent   writet   joint   close(   t   resourcet   pyfilet   f(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt
   write_stub"   s    s7   __import__("pkg_resources").declare_namespace(__name__)t	   bdist_eggc           B   s¾   e  Z d  Z d d d d e ƒ  f d  d	 d
 d d f d! d" g Z d	 d d g Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(#   s   create an "egg" distributions
   bdist-dir=t   bs1   temporary directory for creating the distributions
   plat-name=t   ps;   platform name to embed in generated filenames (default: %s)s   exclude-source-filess+   remove all .py files from the generated eggs	   keep-tempt   ks/   keep the pseudo-installation tree around after s!   creating the distribution archives	   dist-dir=t   ds-   directory to put final built distributions ins
   skip-builds2   skip rebuilding everything (for testing/debugging)c         C   sC   d  |  _ d  |  _ d |  _ d  |  _ d |  _ d  |  _ d  |  _ d  S(   Ni    (   t   Nonet	   bdist_dirt	   plat_namet	   keep_tempt   dist_dirt
   skip_buildt
   egg_outputt   exclude_source_files(   t   self(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt   initialize_options]   s    						c         C   sý   |  j  d ƒ } |  _ | j |  _ |  j d  k r^ |  j  d ƒ j } t j j | d ƒ |  _ n  |  j	 d  k r| t
 ƒ  |  _	 n  |  j d d ƒ |  j d  k rù t d  d  | j | j t ƒ  |  j j ƒ  oË |  j	 ƒ j ƒ  } t j j |  j | d ƒ |  _ n  d  S(   Nt   egg_infot   bdistt   eggR.   s   .egg(   s   dist_dirs   dist_dir(   t   get_finalized_commandt   ei_cmdR4   R+   R*   t
   bdist_baseR   R   R   R,   R   t   set_undefined_optionsR0   R   t   egg_namet   egg_versionR   t   distributiont   has_ext_modulesR.   (   R2   R8   R9   t   basename(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt   finalize_optionsg   s    !c         C   s`  |  j  |  j d ƒ _ t j j t j j t ƒ  ƒ ƒ } |  j j	 g  } |  j _	 xÉ | D]Á } t
 | t ƒ rt | ƒ d k rt j j | d ƒ rt j j | d ƒ } t j j | ƒ } | | k sÝ | j | t j ƒ r| t | ƒ d | d f } qqn  |  j j	 j | ƒ qV Wz1 t j d |  j  ƒ |  j d d d d d  ƒWd  | |  j _	 Xd  S(	   Nt   installi   i    i   s   installing package data to %st   install_datat   forcet   root(   R+   R7   t   install_libR   R   t   normcaset   realpathR   R=   t
   data_filest
   isinstancet   tuplet   lent   isabst
   startswitht   sept   appendR	   t   infot   call_commandR*   (   R2   t   site_packagest   oldt   itemRG   t
   normalized(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt   do_install_data†   s     !!'c         C   s
   |  j  g S(   N(   R0   (   R2   (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt   get_outputs    s    c         K   sm   x! t  D] } | j | |  j ƒ q W| j d |  j ƒ | j d |  j ƒ |  j | | � } |  j | ƒ | S(   s8   Invoke reinitialized command `cmdname` with keyword argsR/   t   dry_run(   t   INSTALL_DIRECTORY_ATTRSt
   setdefaultR+   R/   RX   t   reinitialize_commandt   run_command(   R2   t   cmdnamet   kwt   dirnamet   cmd(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRQ   ¤   s    c      	   C   sà  |  j  d ƒ t j d |  j ƒ |  j d ƒ } | j } d  | _ |  j j ƒ  rk |  j	 rk |  j  d ƒ n  |  j
 d d d ƒ} | | _ |  j ƒ  \ } } g  |  _ g  } xÀ t | ƒ D]² \ } } t j j | ƒ \ }	 }
 t j j |  j t |	 ƒ d ƒ } |  j j | ƒ t j d	 | ƒ |  j sCt t j j | ƒ | ƒ n  | j | ƒ | j t j d
 ƒ | | <q· W| j |  j ƒ  ƒ | r–| j | ƒ n  |  j j r¯|  j ƒ  n  |  j } t j j | d ƒ } |  j | ƒ |  j j r(t j j | d ƒ } t j d | ƒ |  j
 d d | d d ƒn  |  j  | ƒ t j j | d ƒ } | r¶t j d | ƒ |  j sõt! | ƒ t" | d ƒ } | j# d j | ƒ ƒ | j# d ƒ | j$ ƒ  qõn? t j j% | ƒ rõt j d | ƒ |  j sõt j& | ƒ qõn  t' t j j | d ƒ |  j( ƒ  ƒ t j j) t j j |  j* d ƒ ƒ rKt j+ d ƒ n  |  j, ra|  j- ƒ  n  t. |  j/ | d |  j0 d |  j d |  j1 ƒ  ƒ|  j2 s±t3 |  j d |  j ƒn  t4 |  j d g  ƒ j d t5 ƒ  |  j/ f ƒ d  S(   NR4   s   installing library code to %sRA   t
   build_clibRE   t   warn_diri    s   .pys   creating stub loader for %st   /s   EGG-INFOt   scriptss   installing scripts to %st   install_scriptst   install_dirt   no_epi   s   native_libs.txts
   writing %st   wts   
s   removing %ss   depends.txtsx   WARNING: 'depends.txt' will not be used by setuptools 0.6!
Use the install_requires/extras_require setup() args instead.t   verboseRX   t   modet
   dist_filesR%   (6   R\   R	   RP   R+   R7   RD   R*   R=   t   has_c_librariesR/   RQ   t   get_ext_outputst   stubst	   enumerateR   R   R   R   R   RO   RX   R$   R?   t   replaceRN   t   extendt   make_init_filest   byte_compileRH   RV   R   Rd   t   copy_metadata_toR   R   R   R    t   isfilet   unlinkt   write_safety_flagt   zip_safet   existsR4   t   warnR1   t   zap_pyfilest   make_zipfileR0   Ri   t
   gen_headerR-   R   t   getattrR   (   R2   t   instcmdt   old_rootR`   t   all_outputst   ext_outputst
   to_compileR'   t   ext_nameR   t   extR"   t   archive_rootR4   t
   script_dirt   native_libst	   libs_file(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt   run¯   sx    	 			"			
	$
		c         C   s‰   t  j d ƒ xu t |  j ƒ D]d \ } } } xR | D]J } | j d ƒ r3 t j j | | ƒ } t  j d | ƒ t j	 | ƒ q3 q3 Wq Wd  S(   Ns+   Removing .py files from temporary directorys   .pys   Deleting %s(
   R	   RP   t   walk_eggR+   R   R   R   R   t   debugRv   (   R2   t   baset   dirst   filest   nameR   (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR{     s    c         C   sE   t  |  j d d  ƒ } | d  k	 r% | St j d ƒ t |  j |  j ƒ S(   NRx   s4   zip_safe flag not set; analyzing archive contents...(   R~   R=   R*   R	   Rz   t   analyze_eggR+   Rn   (   R2   t   safe(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRx   
  s
    c   	      C   s  g  } xt  |  j ƒ D]ý \ } } } | |  j k r: q n  xÖ | D]Ç } | j d ƒ rA d | k r| t |  j ƒ d j t j d ƒ } |  j j | ƒ rt	 j
 d | ƒ t j j | d ƒ } |  j sñ t | d ƒ } | j t ƒ | j ƒ  n  | j | ƒ qn  PqA qA Wg  | (q W| S(   s%   Create missing package __init__ filess   .pys   __init__.pyi   R   s#   Creating missing __init__.py for %sR   (   R‹   R+   R   RK   Rp   R   RN   R=   t   has_contents_forR	   Rz   R   R   RX   R   R   t   NS_PKG_STUBR    RO   (	   R2   t
   init_filesR�   RŽ   R�   R�   t   pkgR   R#   (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRr     s&    &	 c   
      C   s!  t  j |  j j p d ƒ } | j d i  ƒ j d ƒ } | d  k rF d S| j sY | j ro t d | f ƒ ‚ n  t	 j
 d  } | j } d j | j ƒ } | j d } t j j |  j ƒ } d	 t ƒ  } |  j st t j j |  j ƒ d
 |  j ƒt |  j d ƒ }	 |	 j | ƒ |	 j ƒ  n  d S(   NR   s   setuptools.installationt   eggsecutableR   sG   eggsecutable entry point (%r) cannot have 'extras' or refer to a modulei   R   i    sH  #!/bin/sh
if [ `basename $0` = "%(basename)s" ]
then exec python%(pyver)s -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from %(pkg)s import %(base)s; sys.exit(%(full)s())" "$@"
else
  echo $0 is not the correct name for this egg file.
  echo Please rename it back to %(basename)s and try again.
  exec false
fi
RX   t   a(   R   t	   parse_mapR=   t   entry_pointst   getR*   t   attrst   extrasR
   t   syst   versiont   module_nameR   R   R   R?   R0   t   localsRX   R   R_   R   R   R    (
   R2   t   epmt   ept   pyverR–   t   fullR�   R?   t   headerR#   (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR}   *  s*    	
	"c         C   s“   t  j j |  j ƒ } t  j j | d ƒ } xb |  j j j D]Q } | j | ƒ r: t  j j | | t	 | ƒ ƒ } t
 | ƒ |  j | | ƒ q: q: Wd S(   s*   Copy metadata (egg info) to the target_dirR   N(   R   R   t   normpathR4   R   R8   t   filelistR�   RM   RK   R   t	   copy_file(   R2   t
   target_dirt   norm_egg_infot   prefixR   t   target(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRt   S  s    
c         C   sŠ  g  } g  } i d |  j  6} x¤ t j |  j  ƒ D]� \ } } } xH | D]@ } t j j | ƒ d j ƒ  t k rE | j | | | ƒ qE qE Wx3 | D]+ } | | | d | t j j | | ƒ <q� Wq/ W|  j	 j
 ƒ  r€|  j d ƒ } xœ | j D]Ž }	 t |	 t ƒ rqë n  | j |	 j ƒ }
 | j |
 ƒ } t j j | ƒ j d ƒ së t j j t j j |  j  | ƒ ƒ ry| j | ƒ qyqë që Wn  | | f S(   sA   Get a list of relative paths to C extensions in the output distroR   i   Rc   t	   build_exts   dl-(   R+   R   t   walkR   R   t   lowert   NATIVE_EXTENSIONSRO   R   R=   R>   R7   t
   extensionsRI   R   t   get_ext_fullnameR�   t   get_ext_filenameR?   RM   Ry   (   R2   R�   R‚   t   pathsR�   RŽ   R�   R   t	   build_cmdR…   t   fullname(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRm   _  s(    ""-$(   s
   bdist-dir=R&   s1   temporary directory for creating the distributionN(   s   exclude-source-filesNs+   remove all .py files from the generated egg(   s	   dist-dir=R)   s-   directory to put final built distributions in(   s
   skip-buildNs2   skip rebuilding everything (for testing/debugging)(   t   __name__t
   __module__t   descriptionR   R*   t   user_optionst   boolean_optionsR3   R@   RV   RW   RQ   RŠ   R{   Rx   Rr   R}   Rt   Rm   (    (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR%   4   s8    
   		
					R					)	s   .dll .so .dylib .pydc         c   sh   t  j |  ƒ } t | ƒ \ } } } d | k r@ | j d ƒ n  | | | f Vx | D] } | VqU Wd S(   s@   Walk an unpacked egg's contents, skipping the metadata directorys   EGG-INFON(   R   R¯   R   t   remove(   t   egg_dirt   walkerR�   RŽ   R�   t   bdf(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR‹   €  s    c   	      C   sí   xB t  j ƒ  D]4 \ } } t j j t j j |  d | ƒ ƒ r | Sq Wt ƒ  sR t St } xŽ t	 |  ƒ D]€ \ } } } xn | D]f } | j
 d ƒ s{ | j
 d ƒ r¥ q{ q{ | j
 d ƒ sÃ | j
 d ƒ r{ t |  | | | ƒ oÛ | } q{ q{ Wqe W| S(   Ns   EGG-INFOs   .pys   .pyws   .pycs   .pyo(   t   safety_flagst   itemsR   R   Ry   R   t   can_scanR   t   TrueR‹   R   t   scan_module(	   R¾   Rn   t   flagt   fnR’   R�   RŽ   R�   R�   (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR‘   Š  s    $	 &c         C   sÀ   x¹ t  j ƒ  D]« \ } } t j j |  | ƒ } t j j | ƒ rq | d  k s^ t | ƒ | k r¸ t j | ƒ q¸ q | d  k	 r t | ƒ | k r t	 | d ƒ } | j
 d ƒ | j ƒ  q q Wd  S(   NRh   s   
(   RÁ   RÂ   R   R   R   Ry   R*   t   boolRv   R   R   R    (   R¾   R’   RÆ   RÇ   R#   (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRw   š  s      s   zip-safes   not-zip-safec         C   sã  t  j j | | ƒ } | d  | k r) t S| t |  ƒ d j t  j d ƒ } | | r[ d p^ d t  j j | ƒ d } t j	 d k  rŽ d } n d } t
 | d	 ƒ } | j | ƒ t j | ƒ }	 | j ƒ  t }
 t j t |	 ƒ ƒ } x< d
 d g D]. } | | k rñ t j d | | ƒ t }
 qñ qñ Wd | k rŒxZ d d d d d d d d d d d g D]. } | | k rWt j d | | ƒ t }
 qWqWWn  d | k rßd | k rßd | k rßt j d  d k rßt j d | ƒ t }
 qßn  |
 S(   s;   Check whether module possibly uses unsafe-for-zipfile stuffiÿÿÿÿi   R   R   i    i   i   i   t   rbt   __file__t   __path__s   %s: module references %st   inspectt	   getsourcet
   getabsfilet   getsourcefilet   getfilegetsourcelinest
   findsourcet   getcommentst   getframeinfot   getinnerframest   getouterframest   stackt   traces"   %s: module MAY be using inspect.%sR¸   t   __main__s   2.4s.   %s: top-level module may be 'python -m' script(   i   i   (   R   R   R   RÄ   RK   Rp   RN   R   Rž   t   version_infoR   t   readt   marshalt   loadR    t   dictt   fromkeyst   iter_symbolsR	   Rz   R   RŸ   (   R¾   R�   R�   Rn   R   R–   R   t   skipR#   t   codeR’   t   symbolst   bad(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRÅ   ©  s>    #*	  
	$c         c   sv   x |  j  D] } | Vq
 WxV |  j D]K } t | t ƒ r@ | Vq# t | t ƒ r# x t | ƒ D] } | Vq\ Wq# q# Wd S(   sB   Yield names and strings used by `code` and its nested code objectsN(   t   co_namest	   co_constsRI   R   R   Rß   (   Rá   R�   t   const(    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRß   Ì  s     	c           C   sD   t  j j d ƒ r& t  j d k r& t St j d ƒ t j d ƒ d  S(   Nt   javat   clis1   Unable to analyze compiled code on this platform.sf   Please ask the author to include a 'zip_safe' setting (either True or False) in the package's setup.py(   Rž   t   platformRM   RÄ   R	   Rz   (    (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRÃ   Ö  s    "RE   Rf   RB   t   install_basei    R   c            s  d d l  } t t j j |  ƒ d ˆ ƒt j d |  ˆ  ƒ ‡  ‡ f d †  } | d k rk t j	 d k } n  | j
 | j g t | ƒ } ˆ så | j |  | d | ƒ}	 x0 t j ˆ  ƒ D] \ }
 } } | |	 |
 | ƒ qµ W|	 j ƒ  n3 x0 t j ˆ  ƒ D] \ }
 } } | d |
 | ƒ qõ W|  S(   sq  Create a zip file from all the files under 'base_dir'.  The output
    zip file will be named 'base_dir' + ".zip".  Uses either the "zipfile"
    Python module (if available) or the InfoZIP "zip" utility (if installed
    and found on the default search path).  If neither tool is available,
    raises DistutilsExecError.  Returns the name of the output zip file.
    iÿÿÿÿNRX   s#   creating '%s' and adding '%s' to itc            s‰   x‚ | D]z } t  j j t  j j | | ƒ ƒ } t  j j | ƒ r | t ˆ  ƒ d } ˆ sm |  j | | ƒ n  t j d | ƒ q q Wd  S(   Ni   s   adding '%s'(	   R   R   R§   R   Ru   RK   R   R	   RŒ   (   t   zR_   t   namesR�   R   R'   (   t   base_dirRX   (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt   visit  s    !s   2.4t   compression(   t   zipfileR   R   R   R_   R	   RP   R*   Rž   RŸ   t
   ZIP_STOREDt   ZIP_DEFLATEDRÈ   t   ZipFileR¯   R    (   t   zip_filenameRí   Ri   RX   t   compressRj   Rð   Rî   Rï   Rë   R_   RŽ   R�   (    (   Rí   RX   sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR|     s    		(4   t   __doc__Rž   R   RÛ   t
   setuptoolsR    t   distutils.dir_utilR   R   t	   sysconfigR   R   R   t   ImportErrort   distutils.sysconfigR   t	   distutilsR	   t   distutils.errorsR
   t   pkg_resourcesR   R   R   R   t   typesR   t   setuptools.compatR   R   t   setuptools.extensionR   R   R$   R”   R%   RÝ   RÞ   t   splitR±   R‹   R‘   Rw   RÄ   R   RÁ   RÅ   Rß   RÃ   RY   R*   R|   (    (    (    sV   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt   <module>   sD   $		ÿ H	
		

	#	
	-	