o
    OBié  ã                   @   sž   d dl mZ d dlmZ d dlmZ d dlZd dlZd dlm	Z	 d dl
mZ d dl
mZ d dl
mZ d dl
Z
d	d
lmZ G dd„ deje	ƒZG dd„ dƒZdS )é    )Úconvert_path)Úlog)ÚDistutilsOptionErrorN)Úeasy_install)Ú_normalization)Ú_path)Ú
namespacesé   )Ú_read_utf8_with_fallbackc                   @   sv   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e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ÚuzUninstall this source package)z	egg-path=Nz-Set the path to be used in the .egg-link filer   Fc                 C   s2   | j rd| _|  ¡  |  ¡  n|  ¡  |  ¡  d S )NT)r   Úmulti_versionÚuninstall_linkÚuninstall_namespacesÚinstall_for_developmentÚwarn_deprecated_options©Úself© r   úi/var/www/html/Moveonwheels/move_on_wheels/venv/lib/python3.10/site-packages/setuptools/command/develop.pyÚrun   s   
zdevelop.runc                 C   s&   d | _ d | _t | ¡ d | _d| _d S )NÚ.)r   Úegg_pathr   Úinitialize_optionsÚ
setup_pathÚalways_copy_fromr   r   r   r   r   '   s
   

zdevelop.initialize_optionsc                 C   s  dd l }|  d¡}|jg| _t | ¡ |  ¡  |  ¡  | j 	t
 
d¡¡ t |j¡d }tj | j|¡| _|j| _| jd u rFtj |j¡| _t | j¡}t tj | j| j¡¡}||krbtd| ƒ‚|j|| |tj |j¡¡|jd�| _|  | j| j| j¡| _d S )Nr   Úegg_infoz*.eggz	.egg-linkzA--egg-path must be a relative path from the install directory to ©Úproject_name)Úpkg_resourcesÚget_finalized_commandÚegg_nameÚargsr   Úfinalize_optionsÚexpand_basedirsÚexpand_dirsÚpackage_indexÚscanÚglobr   Úfilename_component_brokenÚosÚpathÚjoinÚinstall_dirÚegg_linkÚegg_baser   Úabspathr   Únormpathr   ÚDistributionÚPathMetadatar   ÚdistÚ_resolve_setup_pathr   )r   r    ÚeiÚegg_link_fnÚtargetr   r   r   r   r$   .   s>   


ÿ
ÿÿý
ýzdevelop.finalize_optionsc                 C   sj   |   tjd¡ d¡}|tjkrd| d¡d  }t tj 	|||¡¡}t tj¡}||kr3t
d||ƒ‚|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   r2   r,   r-   r   )r0   r.   r   Úpath_to_setupÚresolvedr?   r   r   r   r6   W   s   
üzdevelop._resolve_setup_pathc                 C   s¸   |   d¡ | jddd� |   d¡ tjr|  tj¡ d t_|  ¡  t d| j| j	¡ | j
sPt| jddd��}| | jd	 | j ¡ W d   ƒ n1 sKw   Y  |  d | j| j ¡ d S )
Nr   Ú	build_extr;   )ÚinplacezCreating %s (link to %s)Úwzutf-8)ÚencodingÚ
)Úrun_commandÚreinitialize_commandÚ
setuptoolsÚbootstrap_install_fromr   Úinstall_namespacesr   Úinfor/   r0   Údry_runÚopenÚwriter   r   Úprocess_distributionr5   Úno_deps)r   Úfr   r   r   r   l   s   

ÿzdevelop.install_for_developmentc                 C   sž   t j | j¡r9t d| j| j¡ dd„ t| jƒ ¡ D ƒ}|| j	g| j	| j
gfvr0t d|¡ d S | js9t  | j¡ | jsB|  | j¡ | jjrMt d¡ d S d S )NzRemoving %s (link to %s)c                 S   s   g | ]}|  ¡ ‘qS r   )r>   )Ú.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   rM   r0   r
   Ú
splitlinesr   r   ÚwarnrN   ÚunlinkÚ
update_pthr5   ÚdistributionÚscripts)r   Úcontentsr   r   r   r   ‚   s   þþzdevelop.uninstall_linkc                 C   sj   || j urt | |¡S |  |¡ | jjpg D ]}tj t	|ƒ¡}tj 
|¡}t|ƒ}|  ||||¡ qd S ©N)r5   r   Úinstall_egg_scriptsÚinstall_wrapper_scriptsr\   r]   r+   r,   r1   r   Úbasenamer
   Úinstall_script)r   r5   Úscript_nameÚscript_pathÚscript_textr   r   r   r`   –   s   

zdevelop.install_egg_scriptsc                 C   s   t |ƒ}t | |¡S r_   )ÚVersionlessRequirementr   ra   ©r   r5   r   r   r   ra   ©   s   zdevelop.install_wrapper_scriptsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Údescriptionr   Úuser_optionsÚboolean_optionsÚcommand_consumes_argumentsr   r   r$   Ústaticmethodr6   r   r   r`   ra   r   r   r   r   r      s$    þ	)
r   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	rg   a©  
    Adapt a pkg_resources.Distribution to simply return the project
    name as the 'requirement' so that scripts will work across
    multiple versions.

    >>> from pkg_resources import Distribution
    >>> 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'
    c                 C   s
   || _ d S r_   )Ú_VersionlessRequirement__distrh   r   r   r   Ú__init__½   s   
zVersionlessRequirement.__init__c                 C   s   t | j|ƒS r_   )Úgetattrrr   )r   Únamer   r   r   Ú__getattr__À   s   z"VersionlessRequirement.__getattr__c                 C   s   | j S r_   r   r   r   r   r   Úas_requirementÃ   s   z%VersionlessRequirement.as_requirementN)ri   rj   rk   rl   rs   rv   rw   r   r   r   r   rg   ®   s
    rg   )Údistutils.utilr   Ú	distutilsr   Údistutils.errorsr   r+   r)   Úsetuptools.command.easy_installr   rJ   r   r   r   Úunicode_utilsr
   ÚDevelopInstallerr   rg   r   r   r   r   Ú<module>   s     