
    9
g                         d dl Z d dlZd dlZd dlmZmZmZ d dlmZ ddlm	Z	 d dl
mZ d dlmZ d dlmZ  G d	 d
ej                   e      Z G d d      Zy)    N)_normalization_path
namespaces)easy_install   )_read_utf8_with_fallback)log)DistutilsOptionError)convert_pathc                       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d
Zed        ZddZddZd Zd Zy	)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                   r(d| _        | j                          | j                          n| j	                          | j                          y )NT)r   multi_versionuninstall_linkuninstall_namespacesinstall_for_developmentwarn_deprecated_optionsselfs    Z/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/setuptools/command/develop.pyrunzdevelop.run   sA    >>!%D!%%'((*$$&    c                 f    d | _         d | _        t        j                  |        d | _        d| _        y )N.)r   egg_pathr   initialize_options
setup_pathalways_copy_fromr   s    r   r   zdevelop.initialize_options&   s-    ''- #r   Nc           	      b   dd l }| j                  d      }|j                  g| _        t	        j
                  |        | j                          | j                          | j                  j                  t        j                  d             t        j                  |j                        dz   }t        j                  j                  | j                   |      | _        |j$                  | _        | j&                  .t        j                  j)                  |j$                        | _        t+        j,                  | j$                        }t+        j,                  t        j                  j                  | j                   | j&                              }||k7  rt/        d|z         |j1                  ||j3                  |t        j                  j)                  |j4                              |j                        | _        | j9                  | j$                  | j                   | j&                        | _        y )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   s         r   r)   zdevelop.finalize_options-   s   ''
3[[M	%%d+		' 23 44R[[AKO 	 T%5%5{C== GGOOBKK8DM.>>"'',,t/?/?"OPv&!#)*  "..&&vrwwr{{/KL / 
	 22MMMM
r   c                    | j                  t        j                  d      j                  d      }|t        j                  k7  rd|j                  d      dz   z  }t        j                  t        j                  j                  |||            }t        j                  t        j                        }||k7  rt        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)replacer0   seprstripcurdircountr   r7   r1   r2   r
   )r5   r3   r   path_to_setupresolvedrE   s         r   r;   zdevelop._resolve_setup_pathV   s     !((5<<SABII%!]%8%8%=%ABM>>"'',,{Hm"TU		*v&*	  r   c                 p   | j                  d       | j                  dd       | j                  d       t        j                  r*| j	                  t        j                         d t        _        | j                          t        j                  d| j                  | j                         | j                  sLt        | j                  dd      5 }|j                  | j                  d	z   | j                  z          d d d        | j                  d | j                   | j"                          y # 1 sw Y   2xY w)
Nr"   	build_extT)inplacezCreating %s (link to %s)wzutf-8)encoding
)run_commandreinitialize_command
setuptoolsbootstrap_install_fromr   install_namespacesr	   infor4   r5   dry_runopenwriter   r   process_distributionr:   no_deps)r   fs     r   r   zdevelop.install_for_developmentk   s    $ 	!!+t!<%,,j??@04J-! 	+T]]DMMJ||dmmS7;q,t>? < 	!!$		t||3CD	 <;s   ,D,,D5c                    t         j                  j                  | j                        rt	        j
                  d| j                  | j                         t        | j                        j                         D cg c]  }|j                          }}|| j                  g| j                  | j                  gfvrt	        j                  d|       y | j                  st        j                  | j                         | j                  s| j                  | j                          | j"                  j$                  rt	        j                  d       y y c c}w )NzRemoving %s (link to %s)z$Link points to %s: uninstall abortedz5Note: you must uninstall or replace scripts manually!)r0   r1   existsr4   r	   rT   r5   r   
splitlinesrD   r   r   warnrU   unlink
update_pthr:   distributionscripts)r   linecontentss      r   r   zdevelop.uninstall_link   s    77>>$--(HH/N 5T]]CNNPPD P  
 $--1QRR?J<<		$--(||OODII&$$HHLM %s   :Ec                 x   || j                   urt        j                  | |      S | j                  |       | j                  j
                  xs g D ]h  }t        j                  j                  t        |            }t        j                  j                  |      }t        |      }| j                  ||||       j y N)r:   r   install_egg_scriptsinstall_wrapper_scriptsra   rb   r0   r1   r6   r   basenamer   install_script)r   r:   script_namescript_pathscript_texts        r   rg   zdevelop.install_egg_scripts   s    tyy 33D$??
 	$$T*  ,,44::K''//,{*CDK''**;7K2;?Kk;L	 ; r   c                 D    t        |      }t        j                  | |      S rf   )VersionlessRequirementr   rh   r   r:   s     r   rh   zdevelop.install_wrapper_scripts   s    %d+33D$??r   returnN)__name__
__module____qualname____doc__descriptionr   user_optionsboolean_optionscommand_consumes_argumentsr   r   r)   staticmethodr;   r   r   rg   rh    r   r   r   r      sz    (9K,,;L0 L
 #22k]BO!&'$'
R  (E,N(&@r   r   c                   *    e Zd ZdZddZdefdZd Zy)ro   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'
    Nc                     || _         y rf   )_VersionlessRequirement__distrp   s     r   __init__zVersionlessRequirement.__init__   s	    r   namec                 .    t        | j                  |      S rf   )getattrr   )r   r   s     r   __getattr__z"VersionlessRequirement.__getattr__   s    t{{D))r   c                     | j                   S rf   r#   r   s    r   as_requirementz%VersionlessRequirement.as_requirement   s       r   rq   )rs   rt   ru   rv   r   strr   r   r|   r   r   ro   ro      s    * *!r   ro   )r.   r0   rQ   r   r   r   setuptools.command.easy_installr   unicode_utilsr   	distutilsr	   distutils.errorsr
   distutils.utilr   DevelopInstallerr   ro   r|   r   r   <module>r      sF     	  8 8 8 4  1 '[@j))< [@|! !r   