î
½1kd/  ã               @   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   úP/var/www/pythonscrapper/code/venv/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   Zdistutils.errorsr	   r
   r'   r;   rD   r&   r   r   r   r   r   Ú<module>   s   0