ó
˜&>Oc           @   s€   d  d l  m Z d  d l m Z d  d l m Z m Z d  d l Z d  d l Z d  d l	 Z	 d  d l
 Z
 d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   Command(   t   unpack_archive(   t   logt   dir_utilNt   install_egg_infoc           B   s\   e  Z d  Z d  Z d g Z d „  Z d „  Z d „  Z d „  Z d „  Z	 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  |  _ d  |  _ d  S(   N(   t   Nonet   install_dirt   install_layoutt   prefix_option(   t   self(    (    sG   /usr/lib/python2.7/dist-packages/setuptools/command/install_egg_info.pyt   initialize_options   s    		c         C   s0  |  j  d d ƒ |  j  d d ƒ t j d k rB |  j  d d ƒ n  |  j d ƒ } t j d  d  | j | j ƒ j ƒ  d } |  j	 rÂ |  j	 j
 ƒ  d k r¦ t d
 ƒ ‚ n  | j d t j d ƒ } n4 |  j sö d t j k rÝ n | j d t j d ƒ } | j |  _ t j j |  j | ƒ |  _ |  j g |  _ d  S(   Nt   install_libR   t   installR   i  R	   t   egg_infos	   .egg-infot   debs"   unknown value for --install-layouts   -py%st    t   real_prefix(   s   install_dirs   install_dir(   s   install_layouts   install_layout(   s   prefix_options   prefix_option(   R   (   t   set_undefined_optionst   syst
   hexversiont   get_finalized_commandt   pkg_resourcest   DistributionR   t   egg_namet   egg_versionR   t   lowert   DistutilsOptionErrort   replacet   PY_MAJORR	   t   __dict__R   t   sourcet   ost   patht   joinR   t   targett   outputs(   R
   t   ei_cmdt   basename(    (    sG   /usr/lib/python2.7/dist-packages/setuptools/command/install_egg_info.pyt   finalize_options   s&    	c         C   sè   |  j  d ƒ |  j } t j j |  j ƒ r] t j j |  j ƒ r] 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    R!   t   isdirt   islinkR   t   remove_treeR(   t   existst   executet   unlinkR   t   ensure_directoryt   copytreeR   t   install_namespaces(   R
   R#   (    (    sG   /usr/lib/python2.7/dist-packages/setuptools/command/install_egg_info.pyt   run-   s    	+&	c         C   s   |  j  S(   N(   R$   (   R
   (    (    sG   /usr/lib/python2.7/dist-packages/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   /usr/lib/python2.7/dist-packages/setuptools/command/install_egg_info.pyt   skimmer@   s    (   R   R   R#   (   R
   R<   (    (   R
   sG   /usr/lib/python2.7/dist-packages/setuptools/command/install_egg_info.pyR1   >   s    
c         C   sô   |  j  ƒ  } | s d  St j j |  j ƒ \ } } | d 7} |  j j | ƒ t j d | ƒ |  j	 sð t
 | d ƒ } xm | D]e } t | j d ƒ ƒ } d } d | k rË d d j | d  ƒ | d f } n  | j d t ƒ  ƒ qz W| j ƒ  n  d  S(	   Ns
   -nspkg.pths   Installing %st   wtt   .s   
s(   ; m and setattr(sys.modules[%r], %r, m)
iÿÿÿÿs7  import sys,types,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], *%(pth)r); ie = os.path.exists(os.path.join(p,'__init__.py')); m = not ie and sys.modules.setdefault(%(pkg)r,types.ModuleType(%(pkg)r)); mp = (m or []) and m.__dict__.setdefault('__path__',[]); (p not in mp) and mp.append(p)%(trailer)s(   t   _get_all_ns_packagesR    R!   t   splitextR#   R$   R7   R   t   infoR(   t   opent   tuplet   splitR"   t   writet   localst   close(   R
   t   nspt   filenamet   extt   ft   pkgt   ptht   trailer(    (    sG   /usr/lib/python2.7/dist-packages/setuptools/command/install_egg_info.pyR2   d   s&     
 	!c         C   sv   i  } xS |  j  j p g  D]? } | j d ƒ } x' | rW d | d j | ƒ <| j ƒ  q1 Wq Wt | ƒ } | j ƒ  | S(   NR>   i   (   t   distributiont   namespace_packagesRD   R"   t   popt   listt   sort(   R
   RH   RL   (    (    sG   /usr/lib/python2.7/dist-packages/setuptools/command/install_egg_info.pyR?      s    	
(   s   install-dir=R   s   directory to install to(   t   __name__t
   __module__t   __doc__t   descriptiont   user_optionsR   R'   R3   R4   R1   R2   R?   (    (    (    sG   /usr/lib/python2.7/dist-packages/setuptools/command/install_egg_info.pyR      s   						&	(   t
   setuptoolsR    t   setuptools.archive_utilR   t	   distutilsR   R   R    R   t   shutilR   R   (    (    (    sG   /usr/lib/python2.7/dist-packages/setuptools/command/install_egg_info.pyt   <module>   s   0