3 K”Renã@s¨ddlmZddlmZddlmZmZddlZddlZddl Z ddl m Z ddl m Z mZmZddlmZddlmZddlZGd d „d ejeƒZGd d „d eƒZdS) é)Ú convert_path)Úlog)ÚDistutilsErrorÚDistutilsOptionErrorN)Úsix)Ú DistributionÚ PathMetadataÚnormalize_path)Ú easy_install)Ú namespacesc@sveZdZdZdZejddgZejdgZd Zd d „Z d d „Z dd„Z e dd„ƒ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ú�/builddir/build/BUILDROOT/alt-python36-setuptools-38.5.2-7.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/setuptools/command/develop.pyÚruns  z develop.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 j t j dƒƒ|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_inforrÚegg_nameÚargsr Úfinalize_optionsÚexpand_basedirsÚ expand_dirsZ package_indexÚscanÚglobÚosÚpathÚjoinÚ install_dirÚegg_linkÚegg_baserÚabspathr rrrÚdistÚ_resolve_setup_pathr)rÚeiÚtemplater Z egg_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_pathc CsDtjrš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_2to3FÚbuild_pyr)Zinplacer)r+Ú build_extr3zCreating %s (link to %s)ÚwÚ )rÚPY3ÚgetattrÚ distributionÚreinitialize_commandÚ run_commandrr Ú build_librr-ÚlocationrrÚ _providerZinstall_site_pyÚ setuptoolsZbootstrap_install_fromr Zinstall_namespacesrÚinfor*r+Údry_runÚopenÚwriterZprocess_distributionÚno_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 gfkrhtj d|ƒdS|j sztj |jƒ|j sŒ|j|jƒ|jjržtj dƒdS)NzRemoving %s (link to %s)cSsg|] }|jƒ‘qSr)r6)Ú.0Úlinerrrú žsz*develop.uninstall_link..z$Link points to %s: uninstall abortedz5Note: you must uninstall or replace scripts manually!)r&r'Úexistsr*rrFr+rHÚcloserrÚwarnrGÚunlinkZ update_pthr-r?Úscripts)rZ egg_link_fileÚcontentsrrrršs    zdevelop.uninstall_linkc Cs„||jk rtj||ƒS|j|ƒx^|jjp,gD]N}tjjt |ƒƒ}tjj |ƒ}t j |ƒ�}|j ƒ}WdQRX|j||||ƒq.WdS)N)r-r Úinstall_egg_scriptsÚinstall_wrapper_scriptsr?rSr&r'r,rÚbasenameÚiorHÚreadZinstall_script)rr-Ú script_nameZ script_pathÚstrmÚ script_textrrrrU¬s     zdevelop.install_egg_scriptscCst|ƒ}tj||ƒS)N)ÚVersionlessRequirementr rV)rr-rrrrV¾szdevelop.install_wrapper_scripts)r rr)rNr)Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú descriptionr Ú user_optionsÚboolean_optionsZcommand_consumes_argumentsrrr!Ú staticmethodr.rrrUrVrrrrr s  * /r c@s(eZdZdZdd„Zdd„Zdd„ZdS) r]az 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__cCs t|j|ƒS)N)r>rf)rÚnamerrrÚ __getattr__Ôsz"VersionlessRequirement.__getattr__cCs|jS)N)r)rrrrÚas_requirement×sz%VersionlessRequirement.as_requirementN)r^r_r`rargrirjrrrrr]Ãs r])Údistutils.utilrÚ distutilsrÚdistutils.errorsrrr&r%rXZsetuptools.externrÚ pkg_resourcesrrr Zsetuptools.command.easy_installr rEr ZDevelopInstallerr Úobjectr]rrrrÚs     4