
    09oed                         d dl 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
d dlmZ d dlmZ d dlZ G d dej        e          Z G d	 d
          ZdS )    )convert_path)log)DistutilsErrorDistutilsOptionErrorN)easy_install)
namespacesc                       e Zd ZdZdZej        ddgz   Zej        dgz   ZdZd Z	d Z
d	 Zed
             Zd Zd Zd Z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                     | j         r0d| _        |                                  |                                  n|                                  |                                  d S )NT)r   multi_versionuninstall_linkuninstall_namespacesinstall_for_developmentwarn_deprecated_optionsselfs    SD:\Python Project\StaffProfile\venv\Lib\site-packages\setuptools/command/develop.pyrunzdevelop.run   se    > 	+!%D!!!%%''''((***$$&&&&&    c                 f    d | _         d | _        t          j        |            d | _        d| _        d S )N.)r   egg_pathr   initialize_options
setup_pathalways_copy_fromr   s    r   r   zdevelop.initialize_options%   s6    '--- #r   c           	      (   |                      d          }|j        r"d}|j        |j        f}t          ||z            |j        g| _        t          j        |            |                                  | 	                                 | j
                            t          j        d                     |j        dz   }t          j                            | j        |          | _        |j        | _        | j        )t          j                            |j                  | _        t+          j        | j                  }t+          j        t          j                            | j        | j                            }||k    rt/          d|z             t+          j        |t+          j        |t          j                            |j                            |j                  | _        |                     | j        | j        | j                  | _        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)get_finalized_commandbroken_egg_infor   r   egg_nameargsr   finalize_optionsexpand_basedirsexpand_dirspackage_indexscanglobospathjoininstall_diregg_linkegg_baser   abspathpkg_resourcesnormalize_pathr   DistributionPathMetadatadist_resolve_setup_pathr   )r   eitemplater%   egg_link_fntargetr   s          r   r&   zdevelop.finalize_options,   s   ''
33 	2FH; 22D D111[M	%d+++	' 2 2333kK/T%5{CC= GOOBK88DM-dm<< /GLL)4=99
 
 v&!#)*   ".&vrwr{/K/KLL
 
 
	 22MM
 
r   c                    |                      t          j        d                              d          }|t          j        k    rd|                    d          dz   z  }t          j        t          j        	                    |||                    }|t          j        t          j                  k    r-t          d|t          j        t          j                            |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countr3   r4   r-   r.   r   )r1   r/   r   path_to_setupresolveds        r   r8   zdevelop._resolve_setup_pathW   s     !((55<<SAABI%%!]%8%8%=%=%ABM /GLLh>>
 
 }3BI>>>>&*,RY77	   r   c                 T   |                      d           |                     dd           |                      d           t          j        r+|                     t          j                   d t          _        |                                  t          j        d| j        | j	                   | j
        sRt          | j        d          5 }|                    | j        dz   | j        z              d d d            n# 1 swxY w Y   |                     d | j        | j                    d S )Nr   	build_extr?   )inplacezCreating %s (link to %s)w
)run_commandreinitialize_command
setuptoolsbootstrap_install_fromr   install_namespacesr   infor0   r1   dry_runopenwriter   r   process_distributionr7   no_deps)r   fs     r   r   zdevelop.install_for_developmentm   sb   $$$ 	!!+q!999%%%, 	5j?@@@04J-!!! 	+T]DMJJJ| 	@dmS)) @Q,t>???@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 	!!$	t|3CDDDDDs   	&C;;C?C?c                    t           j                            | j                  rt	          j        d| j        | j                   t          | j                  }d |D             }|                                 || j	        g| j	        | j
        gfvrt	          j        d|           d S | j        st          j        | j                   | j        s|                     | j                   | j        j        rt	          j        d           d S d S )NzRemoving %s (link to %s)c                 6    g | ]}|                                 S  )rB   ).0lines     r   
<listcomp>z*develop.uninstall_link.<locals>.<listcomp>   s     @@@$@@@r   z$Link points to %s: uninstall abortedz5Note: you must uninstall or replace scripts manually!)r,   r-   existsr0   r   rQ   r1   rS   closer   r   warnrR   unlink
update_pthr7   distributionscripts)r   egg_link_filecontentss      r   r   zdevelop.uninstall_link   s   7>>$-(( 		)H/NNN //M@@-@@@H!!!$-1QRRR?JJJ< )	$-(((| 	'OODI&&&$ 	NHLMMMMM	N 	Nr   c                    || j         urt          j        | |          S |                     |           | j        j        pg D ]}t          j                            t          |                    }t          j        
                    |          }t          j        |          5 }|                                }d d d            n# 1 swxY w Y   |                     ||||           d S N)r7   r   install_egg_scriptsinstall_wrapper_scriptsrc   rd   r,   r-   r2   r   basenameiorS   readinstall_script)r   r7   script_namescript_pathstrmscript_texts         r   ri   zdevelop.install_egg_scripts   s   ty  3D$???
 	$$T***  ,4: 	M 	MK'//,{*C*CDDK'**;77K%% *"iikk* * * * * * * * * * * * * * *k;LLLL	M 	Ms   #CC	C	c                 J    t          |          }t          j        | |          S rh   )VersionlessRequirementr   rj   r   r7   s     r   rj   zdevelop.install_wrapper_scripts   s"    %d++3D$???r   N)__name__
__module____qualname____doc__descriptionr   user_optionsboolean_optionscommand_consumes_argumentsr   r   r&   staticmethodr8   r   r   ri   rj   rZ   r   r   r
   r
      s        ((9K,;L0 L
 #2k]BO!&' ' '$ $ $)
 )
 )
V   \*E E E,N N N"M M M$@ @ @ @ @r   r
   c                   $    e Zd ZdZd Zd Zd ZdS )rt   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                     || _         d S rh   )_VersionlessRequirement__distru   s     r   __init__zVersionlessRequirement.__init__   s    r   c                 ,    t          | j        |          S rh   )getattrr   )r   names     r   __getattr__z"VersionlessRequirement.__getattr__   s    t{D)))r   c                     | j         S rh   r    r   s    r   as_requirementz%VersionlessRequirement.as_requirement   s      r   N)rv   rw   rx   ry   r   r   r   rZ   r   r   rt   rt      sK           * * *! ! ! ! !r   rt   )distutils.utilr   	distutilsr   distutils.errorsr   r   r,   r+   rl   r3   setuptools.command.easy_installr   rN   r   DevelopInstallerr
   rt   rZ   r   r   <module>r      s
   ' ' ' ' ' '       A A A A A A A A 				  				     8 8 8 8 8 8 ! ! ! ! ! !    Z@ Z@ Z@ Z@ Z@j)< Z@ Z@ Z@z! ! ! ! ! ! ! ! ! !r   