
|«‘_K  ã               @   s§   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l j j Z	 d  d l
 Z
 e	 j Z Gd d „  d e	 j ƒ Z d d „  e	 j j Dƒ e j e _ d S)é    )ÚDistutilsArgErrorNc               @   sÀ   e  Z d  Z d Z e j j d d g Z e j j d d g Z d d d	 „  f d
 d d	 „  f g Z e	 e ƒ Z
 d d „  Z d d „  Z d d „  Z d d „  Z e d d „  ƒ Z d d „  Z d S)Úinstallz7Use easy_install to install the package, w/dependenciesúold-and-unmanageableNúTry not to use this!ú!single-version-externally-managedú5used by system package builders to create 'flat' eggsÚinstall_egg_infoc             C   s   d S)NT© )Úselfr	   r	   ú@/tmp/pip-build-3_sjtvrs/setuptools/setuptools/command/install.pyÚ<lambda>   s    zinstall.<lambda>Úinstall_scriptsc             C   s   d S)NTr	   )r
   r	   r	   r   r      s    c             C   s&   t  j j |  ƒ d  |  _ d  |  _ d  S)N)Úorigr   Úinitialize_optionsÚold_and_unmanageableÚ!single_version_externally_managed)r
   r	   r	   r   r       s    	zinstall.initialize_optionsc             C   sR   t  j j |  ƒ |  j r% d |  _ n) |  j rN |  j rN |  j rN t d ƒ ‚ d  S)NTzAYou must specify --record or --root when building system packages)r   r   Úfinalize_optionsÚrootr   Úrecordr   )r
   r	   r	   r   r   %   s    		zinstall.finalize_optionsc             C   s8   |  j  s |  j r" t j j |  ƒ Sd  |  _ d |  _ d  S)NÚ )r   r   r   r   Úhandle_extra_pathÚ	path_fileÚ
extra_dirs)r
   r	   r	   r   r   0   s    	zinstall.handle_extra_pathc             C   sX   |  j  s |  j r" t j j |  ƒ S|  j t j ƒ  ƒ sJ t j j |  ƒ n
 |  j ƒ  d  S)N)	r   r   r   r   ÚrunÚ_called_from_setupÚinspectÚcurrentframeÚdo_egg_install)r
   r	   r	   r   r   :   s
    zinstall.runc             C   s«   |  d k rH d } t  j | ƒ t j ƒ  d k rD d } t  j | ƒ d St j |  ƒ d } | d d … \ } t j | ƒ } | j j d d	 ƒ } | d
 k oª | j	 d k S)añ  
        Attempt to detect whether run() was called from setup() or by another
        command.  If called by setup(), the parent caller will be the
        'run_command' method in 'distutils.dist', and *its* caller will be
        the 'run_commands' method.  If called any other way, the
        immediate caller *might* be 'run_command', but it won't have been
        called by 'run_commands'. Return True in that case or if a call stack
        is unavailable. Return False otherwise.
        Nz4Call stack not available. bdist_* commands may fail.Ú
IronPythonz6For best results, pass -X:Frames to enable call stack.Té   é   Ú__name__r   zdistutils.distÚrun_commands)
ÚwarningsÚwarnÚplatformÚpython_implementationr   ZgetouterframesZgetframeinfoÚ	f_globalsÚgetÚfunction)Z	run_frameÚmsgÚresZcallerÚinfoZcaller_moduler	   r	   r   r   E   s    zinstall._called_from_setupc             C   sÆ   |  j  j d ƒ } | |  j  d d d |  j d |  j ƒ} | j ƒ  d | _ | j j t j d ƒ ƒ |  j	 d ƒ |  j  j
 d ƒ j g } t j r¦ | j d	 t j ƒ | | _ | j ƒ  d  t _ d  S)
NÚeasy_installÚargsÚxr   r   Ú.z*.eggZ	bdist_eggr   )ÚdistributionÚget_command_classr   r   Úensure_finalizedZalways_copy_fromZpackage_indexÚscanÚglobÚrun_commandÚget_command_objZ
egg_outputÚ
setuptoolsZbootstrap_install_fromÚinsertr.   r   )r
   r-   Úcmdr.   r	   r	   r   r   `   s    $
			
zinstall.do_egg_install)r   Nr   )r   Nr   )r!   Ú
__module__Ú__qualname__Ú__doc__r   r   Úuser_optionsÚboolean_optionsÚnew_commandsÚdictÚ_ncr   r   r   r   Ústaticmethodr   r   r	   r	   r	   r   r      s    	 
	
r   c             C   s)   g  |  ] } | d  t  j k r | ‘ q S)r   )r   rB   )Ú.0r:   r	   r	   r   ú
<listcomp>{   s   	 rE   )Zdistutils.errorsr   r   r5   r#   r%   Údistutils.command.installÚcommandr   r   r8   Ú_installÚsub_commandsr@   r	   r	   r	   r   Ú<module>   s   	l