o g&@sddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddgZ dZ eddZdaiZd d Zed Zed Zd ed fd ed fgZddZddZdad!ddZddZddZdddddddddZdddddddddZddddZd!dd ZdS)"N) resourcesversion bootstrap) setuptoolspipZPackage)r wheel_name wheel_pathz'/opt/alt/python310/share/python-wheels/cCstjtd|}it|<dD]%}d||}t|D]}|t|t| }tj|t||<qqt t t|t j j dS)Nz{}-)z-py2.py3-none-any.whlz-py3-none-any.whlz{}*{})key)ospathjoin_WHEEL_PKG_DIRformat_wheelsgloblenbasenamestrmax distutilsrZ LooseVersion)Zpkgprefixsuffixpatternr Z version_strr9/opt/alt/python310/lib64/python3.10/ensurepip/__init__.py_get_most_recent_wheel_versions rrrZpy3cCsi}zt|}Wn tyd}Ynwt|}|D]2}|ds#qtD] }|d}||r2nq%q||dd}tj ||}t |d|||<q|S)Nrz.whl-r) r listdirOSErrorsortedendswith_PACKAGE_NAMES startswith removeprefix partitionr r _Package)r packages filenamesfilenamenamerrrrrr_find_packages0s(   r*csjtdurtSi}tD]\}}}t||}t||d||<q tr1tttfddtDr1}|a|S)Nc3s|]}|vVqdSNr).0r)Z dir_packagesrr Ysz _get_packages..) _PACKAGES _PROJECTSrr%r r*allr!)r&r)rpy_tagrrr-r _get_packagesMs r3cCsJd|pgd|d}tjddd|g}tjjr|ddtj|d d jS) Nz$ import runpy import sys sys.path = z + sys.path sys.argv[1:] = z> runpy.run_module("pip", run_name="__main__", alter_sys=True) z-Wzignore::DeprecationWarningz-cz-IT)Zcheck)sys executableflagsisolatedinsert subprocessrun returncode)argsadditional_pathscodecmdrrr_run_pip`s  rAcCs tdjS)zA Returns a string specifying the bundled version of pip. r)r3rrrrrrzs cCs2ddtjD}|D]}tj|=q tjtjd<dS)NcSsg|] }|dr|qS)ZPIP_)r")r,krrr sz7_disable_pip_configuration_settings..ZPIP_CONFIG_FILE)r environdevnull)Zkeys_to_removerBrrr#_disable_pip_configuration_settingss rFFrootupgradeuser altinstall default_pip verbositycCst||||||ddS)z Bootstrap pip into the current Python installation (or the given root directory). Note that calling this function will alter both sys.path and os.environ. rGN) _bootstraprGrrrrs  c Csv|r|rtdtd|t|rdtjd<n|s dtjd<t}g}tD]O\}} } t || } tj t | } tj || } t | d$}t | d}||Wdn1s_wYWdn1snwY|| q)dd d d |g}|r|d |g7}|r|d g7}|r|dg7}|r|dd|g7}tg|t|WdS1swYdS)z Bootstrap pip into the current Python installation (or the given root directory). Returns pip command status code. Note that calling this function will alter both sys.path and os.environ. z.Cannot use altinstall and default_pip togetherzensurepip.bootstraprKZENSUREPIP_OPTIONSZinstallrbwbNz--no-cache-dirz --no-indexz --find-links--root --upgrade--userrv) ValueErrorr5auditrFr rDtempfileZTemporaryDirectoryr0rr r r openwritereadappendrAr!)rHrIrJrKrLrMZtmpdirr>Zprojectrr2rZfilename_wheelZ filename_tmpZsfpfpr=rrrrNs@            $rN)rMcCszddl}Wn tyYdSwt}|j|kr*td|jd|dtjddStgd}|r<|dd |g7}tg|t t S) z~Helper to support a clean default uninstall process on Windows Note that calling this function may alter os.environ. rNz2ensurepip will only uninstall a matching version (z installed, z available))file)Z uninstallz-yz--disable-pip-version-checkrrT) r ImportErrorr __version__printr5stderrrFrAreversedr!)rMrZavailable_versionr=rrr_uninstall_helpers(   rccCsddl}|jdd}|jdddtdd|jd d d dd d d|jdddddd|jddddd|jdddd|jddddd|jddddd||}t|j|j|j |j |j |j dS)Nrzpython -m ensurepip)progz --versionrzpip {}z9Show the version of pip that is bundled with this Python.)actionrhelpz-vz --verbosecountrMzDGive more output. Option is additive, and can be used up to 3 times.)redefaultdestrfz-UrR store_trueFz8Upgrade pip and dependencies, even if already installed.)rerhrfrSzInstall using the user scheme.rQz=Install everything relative to this alternate root directory.)rhrfz --altinstallzoMake an alternate install, installing only the X.Y versioned scripts (Default: pipX, pipX.Y, easy_install-X.Y).z --default-pipzqMake a default pip install, installing the unqualified pip and easy_install in addition to the versioned scripts.)rHrIrJrMrKrL) argparseArgumentParser add_argumentrr parse_argsrNrHrIrJrMrKrL)argvrkparserr=rrr_mainsj   rqr+) Zdistutils.versionrr collectionsr Zos.pathr:r5Z sysconfigrW importlibr__all__r! namedtupler%r rrZ_SETUPTOOLS_VERSIONZ _PIP_VERSIONr0r*r3r/rArrFrrNrcrqrrrrsN      8