
_Tc           @   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 Wn1 e k
 r d d l m
 Z
 d d l	 m 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 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   Z+ d d d d g Z, d  d  e- d! d"  Z. d S(#   s6   setuptools.command.bdist_egg

Build .egg distributionsiN(   t   Command(   t   remove_treet   mkpath(   t   get_python_versiont   get_python_lib(   R   (   R   (   t   log(   t   DistutilsSetupError(   t   get_build_platformt   Distributiont   ensure_directory(   t
   EntryPoint(   t   CodeType(   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(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/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(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/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(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyt   initialize_optionsX   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_cmdR.   R%   R$   t
   bdist_baseR   R   R   R&   R   t   set_undefined_optionsR*   R   t   egg_namet   egg_versionR   t   distributiont   has_ext_modulesR(   (   R,   R2   R3   t   basename(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyt   finalize_optionsb   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%   R1   t   install_libR   R   t   normcaset   realpathR   R7   t
   data_filest
   isinstancet   tuplet   lent   isabst
   startswitht   sept   appendR   t   infot   call_commandR$   (   R,   t   site_packagest   oldt   itemRA   t
   normalized(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyt   do_install_data   s     !!'c         C   s
   |  j  g S(   N(   R*   (   R,   (    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/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)   RR   t   reinitialize_commandt   run_command(   R,   t   cmdnamet   kwt   dirnamet   cmd(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyRK      s    c      	   C   s  |  j  d  t j d |  j  |  j d  } | j } d  | _ |  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 st t j j |  |  n  | j |  | j t j d	  | | <q W| j |  j    | rm| 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   r"t j) d  n  |  j* r8|  j+   n  t, |  j- | d |  j. d |  j d |  j/   |  j0 st1 |  j d |  j n  t2 |  j d g   j d t3   |  j- f  d  S(   NR.   s   installing library code to %sR;   R?   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   verboseRR   t   modet
   dist_filesR   (4   RV   R   RJ   R%   R1   R>   R$   RK   t   get_ext_outputst   stubst	   enumerateR   R   R   R   R   RI   RR   R   R9   t   replaceRH   t   extendt   make_init_filest   byte_compileR7   RB   RP   R   R]   t   copy_metadata_toR	   R   R   R   t   isfilet   unlinkt   write_safety_flagt   zip_safet   existsR.   t   warnR+   t   zap_pyfilest   make_zipfileR*   Rb   t
   gen_headerR'   R   t   getattrR   (   R,   t   instcmdt   old_rootRZ   t   all_outputst   ext_outputst
   to_compileR!   t   ext_nameR   t   extR   t   archive_rootR.   t
   script_dirt   native_libst	   libs_file(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyt   run   st    	 			"			
	$
		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   RJ   t   walk_eggR%   R   R   R   R   t   debugRn   (   R,   t   baset   dirst   filest   nameR   (    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyRs      s    c         C   sE   t  |  j d d   } | d  k	 r% | St j d  t |  j |  j  S(   NRp   s4   zip_safe flag not set; analyzing archive contents...(   Rv   R7   R$   R   Rr   t   analyze_eggR%   Rf   (   R,   t   safe(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyRp     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   RE   Rh   R   RH   R7   t   has_contents_forR   Rr   R   R   RR   R   R   t   NS_PKG_STUBR   RI   (	   R,   t
   init_filesR   R   R   R   t   pkgR   R   (    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyRj     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
RR   t   a(   R
   t	   parse_mapR7   t   entry_pointst   getR$   t   attrst   extrasR   t   syst   versiont   module_nameR   R   R   R9   R*   t   localsRR   R   RY   R   R   R   (
   R,   t   epmt   ept   pyverR   t   fullR   R9   t   headerR   (    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyRu   %  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   normpathR.   R   R2   t   filelistR   RG   RE   R	   t	   copy_file(   R,   t
   target_dirt   norm_egg_infot   prefixR   t   target(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyRl   N  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   R\   t	   build_exts   dl-(   R%   R   t   walkR   R   t   lowert   NATIVE_EXTENSIONSRI   R   R7   R8   R1   t
   extensionsRC   R   t   get_ext_fullnameR   t   get_ext_filenameR9   RG   Rq   (   R,   Ry   Rz   t   pathsR   R   R   R   t	   build_cmdR}   t   fullname(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyRe   Z  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_optionsR-   R:   RP   RQ   RK   R   Rs   Rp   Rj   Ru   Rl   Re   (    (    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyR   /   s8    
   		
					R					)	s   .dll .so .dylib .pydc         c   sh   t  j |   } | j   \ } } } 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   t   nextt   remove(   t   egg_dirt   walkerR   R   R   t   bdf(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/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   Rq   R   t   can_scant   Falset   TrueR   R   t   scan_module(	   R   Rf   t   flagt   fnR   R   R   R   R   (    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/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(   NRa   s   
(   R   R   R   R   R   Rq   R$   t   boolRn   R   R   R   (   R   R   R   R   R   (    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyRo     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 | d  } | j	 d  t
 j |  } | j   t }	 t j t |   }
 x< d d	 g D]. } | |
 k r t j d
 | |  t }	 q q Wd |
 k rnxZ d d d d d d d d d d d g D]. } | |
 k r9t j d | |  t }	 q9q9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 stuffii   R   R   i    t   rbi   t   __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__i   s   2.4s.   %s: top-level module may be 'python -m' script(   R   R   R   R   RE   Rh   RH   R   R   t   readt   marshalt   loadR   t   dictt   fromkeyst   iter_symbolsR   Rr   R   R   R   (   R   R   R   Rf   R   R   R   R   t   codeR   t   symbolst   bad(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyR     s8    #*  
	$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_constsRC   t
   basestringR   R   (   R   R   t   const(    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/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   platformRG   R   R   Rr   (    (    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyR     s    "R?   R_   R<   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.
    iNRR   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   Rm   RE   R   R   R   (   t   zRY   t   namesR   R   R!   (   RR   t   base_dir(    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyt   visit
  s    !s   2.4t   compression(   t   zipfileR   R   R   RY   R   RJ   R$   R   R   t
   ZIP_STOREDt   ZIP_DEFLATEDR   t   ZipFileR   R   (   t   zip_filenameR   Rb   RR   t   compressRc   R   R   R   R   RY   R   R   (    (   RR   R   s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyRt     s    		(/   t   __doc__R   R   R   t
   setuptoolsR    t   distutils.dir_utilR   R   t   distutils.sysconfigR   R   t   ImportErrort	   sysconfigt	   distutilsR   t   distutils.errorsR   t   pkg_resourcesR   R   R	   R
   t   typesR   t   setuptools.extensionR   R   R   R   R   R   R   t   splitR   R   R   Ro   R   R   R   R   R   R   RS   R$   Rt   (    (    (    s~   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/bdist_egg.pyt   <module>   s@   $		 H	
		

		
	-	