ó
.żWc           @   sx   d  d l  m Z m Z d  d l Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l
 Z
 d e f d     YZ d S(   i˙˙˙˙(   t   logt   dir_utilN(   t   map(   t   Command(   t   unpack_archivet   install_egg_infoc           B   sw   e  Z d  Z d  Z d g Z d   Z d   Z d   Z d   Z d   Z	 d	   Z
 d Z d Z e d    Z d   Z RS(   s.   Install an .egg-info directory for the packages   install-dir=t   ds   directory to install toc         C   s   d  |  _ d  S(   N(   t   Nonet   install_dir(   t   self(    (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyt   initialize_options   s    c         C   s{   |  j  d d  |  j d  } t j d  d  | j | j  j   d } | j |  _ t	 j
 j |  j |  |  _ g  |  _ d  S(   Nt   install_libR   t   egg_infos	   .egg-info(   s   install_dirs   install_dir(   t   set_undefined_optionst   get_finalized_commandt   pkg_resourcest   DistributionR   t   egg_namet   egg_versionR   t   sourcet   ost   patht   joinR   t   targett   outputs(   R	   t   ei_cmdt   basename(    (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyt   finalize_options   s    	c         C   sß   |  j  d  t j j |  j  rT t j j |  j  rT t j |  j d |  j n; t j j	 |  j  r |  j
 t j |  j f d |  j  n  |  j sŤ t j |  j  n  |  j
 |  j d d |  j |  j f  |  j   d  S(   NR   t   dry_runs	   Removing s   Copying %s to %s(    (   t   run_commandR   R   t   isdirR   t   islinkR   t   remove_treeR   t   existst   executet   unlinkR   t   ensure_directoryt   copytreeR   t   install_namespaces(   R	   (    (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyt   run"   s    +&	 c         C   s   |  j  S(   N(   R   (   R	   (    (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyt   get_outputs/   s    c            s)     f d   } t    j   j |  d  S(   Nc            s[   x1 d D]) } |  j  |  s, d | |  k r d  Sq W  j j |  t j d |  |  | S(   Ns   .svn/s   CVS/t   /s   Copying %s to %s(   s   .svn/s   CVS/(   t
   startswithR   R   t   appendR    t   debug(   t   srct   dstt   skip(   R	   (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyt   skimmer4   s    (   R   R   R   (   R	   R0   (    (   R	   sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyR%   2   s    c         C   s­   |  j    } | s d  St j j |  j  \ } } | d 7} |  j j |  t j d |  t	 |  j
 |  } |  j r t |  d  St | d   } | j |  Wd  QXd  S(   Ns
   -nspkg.pths   Installing %st   wt(   t   _get_all_ns_packagesR   R   t   splitextR   R   R+   R    t   infoR   t   _gen_nspkg_lineR   t   listt   opent
   writelines(   R	   t   nspt   filenamet   extt   linest   f(    (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyR&   A   s    
	
s   import sys, types, oss@   p = os.path.join(sys._getframe(1).f_locals['sitedir'], *%(pth)r)s2   ie = os.path.exists(os.path.join(p,'__init__.py'))sI   m = not ie and sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))s7   mp = (m or []) and m.__dict__.setdefault('__path__',[])s   (p not in mp) and mp.append(p)s4   m and setattr(sys.modules[%(parent)r], %(child)r, m)c         C   sp   t  |  } t | j d   } |  j } | j d  \ } } } | rX | |  j 7} n  d j |  t   d S(   Nt   .t   ;s   
(   t   strt   tuplet   splitt   _nspkg_tmplt
   rpartitiont   _nspkg_tmpl_multiR   t   locals(   t   clst   pkgt   ptht
   tmpl_linest   parentt   sept   child(    (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyR5   c   s    	c         C   sl   t    } xV |  j j p g  D]B } | j d  } x* | r] | j d j |   | j   q4 Wq Wt |  S(   s,   Return sorted list of all package namespacesR>   (   t   sett   distributiont   namespace_packagesRB   t   addR   t   popt   sorted(   R	   R9   RH   (    (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyR2   n   s    		(   s   install-dir=R   s   directory to install to(   s   import sys, types, oss@   p = os.path.join(sys._getframe(1).f_locals['sitedir'], *%(pth)r)s2   ie = os.path.exists(os.path.join(p,'__init__.py'))sI   m = not ie and sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))s7   mp = (m or []) and m.__dict__.setdefault('__path__',[])s   (p not in mp) and mp.append(p)(   s4   m and setattr(sys.modules[%(parent)r], %(child)r, m)(   t   __name__t
   __module__t   __doc__t   descriptiont   user_optionsR
   R   R'   R(   R%   R&   RC   RE   t   classmethodR5   R2   (    (    (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyR      s$   							     (   t	   distutilsR    R   R   t   setuptools.extern.six.movesR   t
   setuptoolsR   t   setuptools.archive_utilR   R   R   (    (    (    sG   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/install_egg_info.pyt   <module>   s   