î
É Xò  ã               @   st   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	 Gd d „  d e ƒ Z
 d S)é    )ÚCommand)Úunpack_archive)ÚlogÚdir_utilNc               @   sy   e  Z d  Z d Z d Z d g Z d d „  Z d d „  Z d	 d
 „  Z d d „  Z	 d d „  Z
 d d „  Z d d „  Z d S)Úinstall_egg_infoz.Install an .egg-info directory for the packageúinstall-dir=Údúdirectory to install toc             C   s   d  |  _  d  |  _ d  |  _ d  S)N)Úinstall_dirÚinstall_layoutÚprefix_option)Úself© r   úU/home/ubuntu/projects/ifolica/build/setuptools/setuptools/command/install_egg_info.pyÚinitialize_options   s    		z#install_egg_info.initialize_optionsc             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)NÚinstall_libr
   Úinstallr   i  r   Úegg_infoz	.egg-infoÚdebz"unknown value for --install-layoutz-py%sÚ Úreal_prefix)úinstall_dirr   )úinstall_layoutr   )úprefix_optionr   )zdeb)Úset_undefined_optionsÚsysÚ
hexversionÚget_finalized_commandÚpkg_resourcesÚDistributionÚegg_nameZegg_versionr   ÚlowerÚDistutilsOptionErrorÚreplaceÚPY_MAJORr   Ú__dict__r   ÚsourceÚosÚpathÚjoinr
   ÚtargetÚoutputs)r   Zei_cmdÚbasenamer   r   r   Úfinalize_options   s&    	z!install_egg_info.finalize_optionsc             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 f  d |  j |  j f ƒ |  j ƒ  d  S)Nr   Údry_runz	Removing zCopying %s to %s)Úrun_commandr*   r'   r(   ÚisdirÚislinkr   Úremove_treer.   ÚexistsÚexecuteÚunlinkr   Úensure_directoryÚcopytreer&   Úinstall_namespaces)r   r*   r   r   r   Úrun-   s    	+&	zinstall_egg_info.runc             C   s   |  j  S)N)r+   )r   r   r   r   Úget_outputs;   s    zinstall_egg_info.get_outputsc                s,   ‡  f d 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)Nú.svn/úCVS/ú/zCopying %s to %s)r;   r<   )Ú
startswithr+   Úappendr   Údebug)ÚsrcÚdstÚskip)r   r   r   Úskimmer@   s    z*install_egg_info.copytree.<locals>.skimmer)r   r&   r*   )r   rD   r   )r   r   r7   >   s    
zinstall_egg_info.copytreec             C   s  |  j  ƒ  } | s d  St j j |  j ƒ \ } } | d 7} |  j j | ƒ t j d | ƒ |  j	 st
 | d ƒ } x | D]w } t | ƒ } t | j d ƒ ƒ } d } d | k rÝ d d j | d  d	 … ƒ | d
 f } n  | j d t ƒ  ƒ qz W| j ƒ  n  d  S)Nz
-nspkg.pthzInstalling %sZwtÚ.Ú
z(; m and setattr(sys.modules[%r], %r, m)
é   a7  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éÿÿÿÿrH   )Ú_get_all_ns_packagesr'   r(   Úsplitextr*   r+   r?   r   Úinfor.   ÚopenÚstrÚtupleÚsplitr)   ÚwriteÚlocalsÚclose)r   ÚnspÚfilenameÚextÚfÚpkgÚpthÚtrailerr   r   r   r8   d   s(     
 	'z#install_egg_info.install_namespacesc             C   sv   i  } xS |  j  j p g  D]? } | j d ƒ } x' | rW d | d j | ƒ <| j ƒ  q1 Wq Wt | ƒ } | j ƒ  | S)NrE   rG   )ÚdistributionZnamespace_packagesrO   r)   ÚpopÚlistÚsort)r   rS   rW   r   r   r   rI   ƒ   s    	
z%install_egg_info._get_all_ns_packagesN)r   r   r	   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚdescriptionÚuser_optionsr   r-   r9   r:   r7   r8   rI   r   r   r   r   r      s   	&r   )Ú
setuptoolsr   Zsetuptools.archive_utilr   Ú	distutilsr   r   r'   r   r   r   r   r   r   r   Ú<module>   s   $