a [Îdgmã@sŽddlmZddlmZddlmZmZddlZddlZddl Z ddl Z ddl m Z ddl mZddl Z Gdd„deje ƒZGd d „d ƒZdS) é)Ú convert_path)Úlog)ÚDistutilsErrorÚDistutilsOptionErrorN)Ú easy_install)Ú namespacesc@sveZdZdZdZejddgZejdgZdZdd„Z d d „Z d d „Z e d d„ƒZ dd„Zdd„Zdd„Zdd„ZdS)ÚdevelopzSet up package for developmentz%install package in 'development mode')Ú uninstallÚuzUninstall this source package)z egg-path=Nz-Set the path to be used in the .egg-link filer FcCs2|jrd|_| ¡| ¡n| ¡| ¡dS)NT)r Z multi_versionÚuninstall_linkZuninstall_namespacesÚinstall_for_developmentZwarn_deprecated_options©Úself©rúD/usr/local/lib/python3.9/site-packages/setuptools/command/develop.pyÚruns  z develop.runcCs&d|_d|_t |¡d|_d|_dS)NÚ.)r Úegg_pathrÚinitialize_optionsÚ setup_pathZalways_copy_fromr rrrr%s  zdevelop.initialize_optionscCs| d¡}|jr,d}|j|jf}t||ƒ‚|jg|_t |¡| ¡|  ¡|j   t   d¡¡|jd}t j |j|¡|_|j|_|jdur t j |j¡|_t |j¡}t t j |j|j¡¡}||krØtd|ƒ‚tj|t |t j |j¡¡|jd|_| |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 ©Z project_name)Úget_finalized_commandZbroken_egg_inforrZegg_nameÚargsrÚfinalize_optionsZexpand_basedirsZ expand_dirsZ package_indexÚscanÚglobÚosÚpathÚjoinÚ install_dirÚegg_linkÚegg_baserÚabspathÚ pkg_resourcesÚnormalize_pathrZ DistributionÚ PathMetadataÚdistÚ_resolve_setup_pathr)rÚeiÚtemplaterZ egg_link_fnÚtargetrrrrr,sF        ÿÿÿýýzdevelop.finalize_optionscCsn| tjd¡ d¡}|tjkr0d| d¡d}t tj  |||¡¡}|t tj¡krjt d|t tj¡ƒ‚|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%rrr)r"r rZ path_to_setupZresolvedrrrr(Vs ÿ ýzdevelop._resolve_setup_pathcCsPt|jddƒr˜|jddd| d¡| d¡}t |j¡}|jd|d| d¡|jddd| d¡| d¡}||_||j _ t  ||j ¡|j _ n"| d¡|jdd d| d¡tjrÒ| tj¡dt_| ¡t d |j|j¡|js8t|jd ƒ&}| |jd |j¡Wdƒn1s.0Y| d|j |j ¡dS) NZuse_2to3FZbuild_pyr)Zinplacer)r"Z build_extr-zCreating %s (link to %s)ÚwÚ )ÚgetattrÚ distributionZreinitialize_commandZ run_commandrr$r%Z build_librr'Úlocationr&rZ _providerÚ setuptoolsZbootstrap_install_fromrZinstall_namespacesrÚinfor!r"Údry_runÚopenÚwriterZprocess_distributionZno_deps)rZbpy_cmdZ build_pathZei_cmdÚfrrrr js6      ÿ    6zdevelop.install_for_developmentcCs¢tj |j¡rzt d|j|j¡t|jƒ}dd„|Dƒ}| ¡||j g|j |j gfvrht  d|¡dS|j szt  |j¡|j sŒ| |j¡|jjržt  d¡dS)NzRemoving %s (link to %s)cSsg|] }| ¡‘qSr)r0)Ú.0ÚlinerrrÚ óz*develop.uninstall_link..z$Link points to %s: uninstall abortedz5Note: you must uninstall or replace scripts manually!)rrÚexistsr!rr9r"r;ÚcloserrÚwarnr:ÚunlinkZ update_pthr'r6Úscripts)rZ egg_link_fileÚcontentsrrrr ™s   ÿ   zdevelop.uninstall_linkc Cs”||jurt ||¡S| |¡|jjp*gD]b}tj t |ƒ¡}tj  |¡}t   |¡}|  ¡}Wdƒn1st0Y| ||||¡q,dS©N)r'rÚinstall_egg_scriptsÚinstall_wrapper_scriptsr6rFrrr#rÚbasenameÚior;ÚreadZinstall_script)rr'Z script_nameZ script_pathZstrmZ script_textrrrrI«s     &zdevelop.install_egg_scriptscCst|ƒ}t ||¡SrH)ÚVersionlessRequirementrrJ©rr'rrrrJ½szdevelop.install_wrapper_scriptsN)Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú descriptionrZ user_optionsZboolean_optionsZcommand_consumes_argumentsrrrÚ staticmethodr(r r rIrJrrrrrs"þ  * /rc@s(eZdZdZdd„Zdd„Zdd„ZdS) rNa© 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' cCs ||_dSrH)Ú_VersionlessRequirement__distrOrrrÚ__init__ÑszVersionlessRequirement.__init__cCs t|j|ƒSrH)r5rV)rÚnamerrrÚ __getattr__Ôsz"VersionlessRequirement.__getattr__cCs|jSrHrr rrrÚas_requirement×sz%VersionlessRequirement.as_requirementN)rPrQrRrSrWrYrZrrrrrNÂsrN)Zdistutils.utilrZ distutilsrZdistutils.errorsrrrrrLr$Zsetuptools.command.easy_installrr8rZDevelopInstallerrrNrrrrÚs    5