????
Your IP : 18.218.140.12
3
U('dn�@s�ddlmZddlmZddlmZmZddlZddlZddl Z ddl
mZddlm
Z
mZmZddlmZddlmZddlZGd d
�d
eje�ZGdd�de�ZdS)
�)�convert_path)�log)�DistutilsError�DistutilsOptionErrorN)�six)�Distribution�PathMetadata�normalize_path)�easy_install)�
namespacesc@sveZdZdZdZejddgZejdgZd Zd
d�Z dd
�Z
dd�Zedd��Z
dd�Zdd�Zdd�Zdd�ZdS)�developzSet 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 fileFcCs2|jrd|_|j�|j�n|j�|j�dS)NT)r
Z
multi_version�uninstall_linkZuninstall_namespaces�install_for_developmentZwarn_deprecated_options)�self�r�/usr/lib/python3.6/develop.py�runs
zdevelop.runcCs&d|_d|_tj|�d|_d|_dS)N�.)r
�egg_pathr
�initialize_options�
setup_pathZalways_copy_from)rrrrr's
zdevelop.initialize_optionscCs|jd�}|jr,d}|j|jf}t||��|jg|_tj|�|j�|j �|j
jtjd��|jd}t
jj|j|�|_|j|_|jdkr�t
jj|j�|_t|j�}tt
jj|j|j��}||kr�td|��t|t|t
jj|j��|jd�|_|j|j|j|j�|_dS)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)�get_finalized_commandZbroken_egg_inforrZegg_name�argsr
�finalize_optionsZexpand_basedirsZexpand_dirsZ
package_index�scan�glob�os�path�join�install_dir�egg_link�egg_baser�abspathr rrr�dist�_resolve_setup_pathr)rZei�templaterZegg_link_fn�targetrrrrr .s<
zdevelop.finalize_optionscCsh|jtjd�jd�}|tjkr0d|jd�d}ttjj|||��}|ttj�krdt d|ttj���|S)z�
Generate a path from egg_base back to '.' where the
setup script resides and ensure that path points to the
setup path from $install_dir/$egg_path.
�/z../�zGCan't get a consistent path to setup script from installation directory)
�replacer#�sep�rstrip�curdir�countr r$r%r)r(r&rZ
path_to_setupZresolvedrrrr+Xs
zdevelop._resolve_setup_pathcCsDtjr�t|jdd�r�|jddd�|jd�|jd�}t|j�}|jd|d�|jd�|jddd�|jd�|jd�}||_ ||j
_t||j
�|j
_n"|jd�|jdd d�|jd�|j�tjr�|jtj�dt_|j�tjd
|j|j�|j�s,t|jd��}|j|j d|j�WdQRX|jd|j
|j�dS)
NZuse_2to3FZbuild_pyr)Zinplacer)r(Z build_extr/zCreating %s (link to %s)�w�
)rZPY3�getattr�distributionZreinitialize_commandZrun_commandrr Z build_librr*�locationrrZ _providerZinstall_site_py�
setuptoolsZbootstrap_install_fromr
Zinstall_namespacesr�infor'r(�dry_run�open�writerZprocess_distributionZno_deps)rZbpy_cmdZ
build_pathZei_cmd�frrrrks4
zdevelop.install_for_developmentcCs�tjj|j�rztjd|j|j�t|j�}dd�|D�}|j�||j g|j |j
gfkrhtjd|�dS|jsztj
|j�|js�|j|j�|jjr�tjd�dS)NzRemoving %s (link to %s)cSsg|]}|j��qSr)r2)�.0�linerrr�
<listcomp>�sz*develop.uninstall_link.<locals>.<listcomp>z$Link points to %s: uninstall abortedz5Note: you must uninstall or replace scripts manually!)r#r$�existsr'rr;r(r=�closerr�warnr<�unlinkZ
update_pthr*r8�scripts)rZ
egg_link_file�contentsrrrr�s
zdevelop.uninstall_linkc
Cs�||jk rtj||�S|j|�x^|jjp,gD]N}tjjt |��}tjj
|�}tj|��}|j
�}WdQRX|j||||�q.WdS)N)r*r
�install_egg_scripts�install_wrapper_scriptsr8rGr#r$r)r�basename�ior=�readZinstall_script)rr*Zscript_nameZscript_pathZstrmZscript_textrrrrI�s
zdevelop.install_egg_scriptscCst|�}tj||�S)N)�VersionlessRequirementr
rJ)rr*rrrrJ�szdevelop.install_wrapper_scripts)r
rr)rNr)�__name__�
__module__�__qualname__�__doc__�descriptionr
Zuser_optionsZboolean_optionsZcommand_consumes_argumentsrrr �staticmethodr+rrrIrJrrrrrs */rc@s(eZdZdZdd�Zdd�Zdd�ZdS) rNaz
Adapt a pkg_resources.Distribution to simply return the project
name as the 'requirement' so that scripts will work across
multiple versions.
>>> dist = Distribution(project_name='foo', version='1.0')
>>> str(dist.as_requirement())
'foo==1.0'
>>> adapted_dist = VersionlessRequirement(dist)
>>> str(adapted_dist.as_requirement())
'foo'
cCs
||_dS)N)�_VersionlessRequirement__dist)rr*rrr�__init__�szVersionlessRequirement.__init__cCst|j|�S)N)r7rU)r�namerrr�__getattr__�sz"VersionlessRequirement.__getattr__cCs|jS)N)r)rrrr�as_requirement�sz%VersionlessRequirement.as_requirementN)rOrPrQrRrVrXrYrrrrrN�srN)Zdistutils.utilrZ distutilsrZdistutils.errorsrrr#r"rLZsetuptools.externrZ
pkg_resourcesrrr Zsetuptools.command.easy_installr
r:rZDevelopInstallerr�objectrNrrrr�<module>s4