o ~Red@sddlmZddlmZddlmZmZddlZddlZddl Z ddl Z ddl m Z ddl mZddl Z Gdddeje ZGd d d ZdS) ) convert_path)log)DistutilsErrorDistutilsOptionErrorN) easy_install) namespacesc@sveZdZdZdZejddgZejdgZdZddZ d d Z d d Z e d dZ ddZddZddZddZdS)developzSet up package for developmentz%install package in 'development mode') uninstalluzUninstall 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_versionuninstall_linkZuninstall_namespacesinstall_for_developmentZwarn_deprecated_optionsselfr/builddir/build/BUILDROOT/alt-python310-setuptools-58.3.0-2.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/setuptools/command/develop.pyruns   z develop.runcCs&d|_d|_t|d|_d|_dS)N.)r egg_pathrinitialize_options setup_pathZalways_copy_fromr rrrr%s   zdevelop.initialize_optionscCs|d}|jrd}|j|jf}t|||jg|_t||| |j t d|jd}t j|j||_|j|_|jdurPt j|j|_t|j}tt j|j|j}||krltd|tj|t|t j|j|jd|_||j|j|j|_dS)Negg_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_inforregg_nameargsrfinalize_optionsexpand_basedirs expand_dirsZ package_indexscanglobospathjoin install_diregg_linkegg_baserabspath pkg_resourcesnormalize_pathr Distribution PathMetadatadist_resolve_setup_pathr)reitemplaterZ egg_link_fntargetrrrrr,sF         zdevelop.finalize_optionscCsn|tjdd}|tjkrd|dd}ttj |||}|ttjkr5t 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!seprstripcurdircountr(r)r"r#r)r&r$rZ path_to_setupresolvedrrrr-Ws  zdevelop._resolve_setup_pathcCs|d|jddd|dtjr|tjdt_|td|j|j |j sNt |jd}| |j d|jWdn1sIwY|d|j|j dS)Nr build_extr2)ZinplacezCreating %s (link to %s)w ) run_commandreinitialize_command setuptoolsZbootstrap_install_fromrZinstall_namespacesrinfor%r&dry_runopenwriterrZprocess_distributionr,no_deps)rfrrrr ms   zdevelop.install_for_developmentcCstj|jr=td|j|jt|j}dd|D}|||j g|j |j gfvr4t d|dS|j s=t |j|j sF||j|jjrQt ddSdS)NzRemoving %s (link to %s)cSsg|]}|qSr)r5).0linerrr sz*develop.uninstall_link..z$Link points to %s: uninstall abortedz5Note: you must uninstall or replace scripts manually!)r!r"existsr%rr?r&rAcloserrwarnr@unlinkZ update_pthr, distributionscripts)rZ egg_link_filecontentsrrrr s    zdevelop.uninstall_linkc Cs||jur t||S|||jjpgD]1}tjt |}tj |}t | }| }Wdn1s:wY|||||qdSN)r,rinstall_egg_scriptsinstall_wrapper_scriptsrLrMr!r"r'rbasenameiorAreadZinstall_script)rr, script_nameZ script_pathstrm script_textrrrrPs      zdevelop.install_egg_scriptscCst|}t||SrO)VersionlessRequirementrrQrr,rrrrQs zdevelop.install_wrapper_scriptsN)__name__ __module__ __qualname____doc__ descriptionr user_optionsboolean_optionsZcommand_consumes_argumentsrrr staticmethodr-r r rPrQrrrrrs$  +  rc@s(eZdZdZddZddZddZdS) rXa 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 ||_dSrO)_VersionlessRequirement__distrYrrr__init__s zVersionlessRequirement.__init__cCs t|j|SrO)getattrrb)rnamerrr __getattr__s z"VersionlessRequirement.__getattr__cCs|jSrOrr rrras_requirementsz%VersionlessRequirement.as_requirementN)rZr[r\r]rcrfrgrrrrrXs  rX)distutils.utilr distutilsrdistutils.errorsrrr!r rSr(Zsetuptools.command.easy_installrr>rZDevelopInstallerrrXrrrrs