
 X/                 @   s   d  d l  m Z d  d l m Z m Z d  d l m Z m Z 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 Gd d   d e  Z d S)	    )easy_install)convert_path
subst_vars)DistributionPathMetadatanormalize_path)log)DistutilsErrorDistutilsOptionErrorNc               @   s   e  Z d  Z d Z d Z e j d d g Z e j d g Z d	 Z d
 d   Z	 d d   Z
 d d   Z d d   Z d d   Z d d   Z d S)developzSet up package for developmentz%install package in 'development mode'	uninstalluUninstall this source package	egg-path=N-Set the path to be used in the .egg-link fileFc             C   s7   |  j  r d |  _ |  j   n
 |  j   |  j   d  S)NT)r   Zmulti_versionuninstall_linkinstall_for_developmentZwarn_deprecated_options)self r   L/home/ubuntu/projects/ifolica/build/setuptools/setuptools/command/develop.pyrun   s
    		
zdevelop.runc             C   s5   d  |  _  d  |  _ t j |   d  |  _ d |  _ d  S)N.)r   egg_pathr   initialize_options
setup_pathZalways_copy_from)r   r   r   r   r      s
    			zdevelop.initialize_optionsc             C   s  |  j  d  } | j r7 t d | j | j f   n  | j g |  _ t j |   |  j   |  j	   |  j
 j t j d   t j j |  j | j d  |  _ | j |  _ |  j d  k r t j j | j  |  _ n  t |  j  } t t j j |  j |  j   | k r!t d |   n  t | t | t j j | j   d | j |  _ |  j j t j d  } | t j k rd | j d  d	 } n  | |  _ t t j j |  j |  j |   } | t t j  k rt d
 | t t j    n  d  S)Negg_infoz-Please rename %r to %r before using 'develop'z*.eggz	.egg-linkzA--egg-path must be a relative path from the install directory to project_name/z../   zGCan't get a consistent path to setup script from installation directory)get_finalized_commandZbroken_egg_infor	   r   egg_nameargsr   finalize_optionsexpand_basedirsexpand_dirsZpackage_indexscanglobospathjoininstall_diregg_linkegg_baser   abspathr   r
   r   r   distreplacesepcurdircountr   )r   eitargetpr   r   r   r"   '   s@    	

"'	$zdevelop.finalize_optionsc             C   s  t  j d k r t |  j d d  r |  j d d d |  j d  |  j d  } t | j  } |  j d d | |  j d  |  j d	 d d |  j d	  |  j d  } | |  _	 | |  j
 _ t | | j  |  j
 _ n- |  j d  |  j d	 d d
 |  j d	  |  j   t j r=|  j t j  d  t _ n  t j d |  j |  j  |  j st |  j d  } | j |  j	 d |  j  | j   n  |  j d  |  j
 |  j  d  S)N   Zuse_2to3Fbuild_pyZinplacer   r   r,   	build_extr   zCreating %s (link to %s)w
)r6   )sysversion_infogetattrdistributionreinitialize_commandrun_commandr   r   	build_libr   r.   locationr   r   	_providerZinstall_site_py
setuptoolsZbootstrap_install_fromr   r   infor+   r,   dry_runopenwriter   closeZprocess_distributionno_deps)r   Zbpy_cmdZ
build_pathZei_cmdfr   r   r   r   V   s4    $	
		zdevelop.install_for_developmentc             C   s   t  j j |  j  r t j d |  j |  j  t |  j  } d d   | D } | j   | |  j	 g |  j	 |  j
 g f k r t j d |  d  S|  j s t  j |  j  q n  |  j s |  j |  j  n  |  j j r t j d  n  d  S)NzRemoving %s (link to %s)c             S   s   g  |  ] } | j     q Sr   )rstrip).0liner   r   r   
<listcomp>   s   	 z*develop.uninstall_link.<locals>.<listcomp>z$Link points to %s: uninstall abortedz5Note: you must uninstall or replace scripts manually!)r'   r(   existsr+   r   rE   r,   rG   rI   r   r   warnrF   unlinkZ
update_pthr.   r>   scripts)r   Zegg_link_filecontentsr   r   r   r      s    
$		zdevelop.uninstall_linkc             C   s   | |  j  k	 r t j |  |  S|  j |  x |  j j p> g  D]k } t j j t	 |   } t j j
 |  } t | d  } | j   } | j   |  j | | | |  q? Wd  S)NrU)r.   r   install_egg_scriptsZinstall_wrapper_scriptsr>   rS   r'   r(   r-   r   basenamerG   readrI   Zinstall_script)r   r.   script_nameZscript_pathrK   script_textr   r   r   rV      s    
zdevelop.install_egg_scripts)z	uninstallr   r   )r   Nr   )__name__
__module____qualname____doc__descriptionr   user_optionsboolean_optionsZcommand_consumes_argumentsr   r   r"   r   r   rV   r   r   r   r   r      s   
	/.r   )Zsetuptools.command.easy_installr   distutils.utilr   r   pkg_resourcesr   r   r   	distutilsr   distutils.errorsr	   r
   r'   r;   rD   r&   r   r   r   r   r   <module>   s   0