f _c@sddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddgZ dZ iZ ddZedZed Zded fd ed fgZdd d ZddZddZdddddddddZdddddddddZddddZdddZdS)N) resourcesversion bootstrapz/usr/share/python-wheels/cCstjtd|}it|<dD]J}d||}t|D].}|t|t| }tj|t||<q:q t t t|t j j dS)Nz{}-)z-py2.py3-none-any.whlz-py3-none-any.whlz{}*{})Zkey)ospathjoin _WHEEL_DIRformat_wheelsglobZlenZbasenameZstrZmax distutilsrZ LooseVersion)ZpkgZprefixZsuffixZpatternrZ version_strr +/usr/lib64/python3.10/ensurepip/__init__.py_get_most_recent_wheel_versions rZ setuptoolspipZpy3zpy2.py3cCs.d|pgd|d}tjtjd|gddjS)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-cT)Zcheck) subprocessZrunsysZ executableZ returncode)argsadditional_pathsZcoder r r _run_pip(s rcCstS)zA Returns a string specifying the bundled version of pip. ) _PIP_VERSIONr r r r r7scCs2ddtjD}|D] }tj|=qtjtjd<dS)NcSsg|]}|dr|qS)ZPIP_)Z startswith).0kr r r Az7_disable_pip_configuration_settings..ZPIP_CONFIG_FILE)renvironZdevnull)Zkeys_to_removerr r r #_disable_pip_configuration_settings=s rFrootupgradeuser 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. rN) _bootstraprr r r rIs c Cs|r|rtdtd|t|r2dtjd<n|s@dtjd<t*}g}tD]\}} } t || } t tj t | dR} t tj || d} | | Wdn1s0YWdn1s0Y|tj || qTdd d d |g}|r|d |g7}|r&|d g7}|r6|dg7}|rN|dd|g7}t|ddtD|WdS1s|0YdS)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.bootstrapr ZENSUREPIP_OPTIONSZinstallZrbZwbNz--no-cache-dirz --no-indexz --find-links--root --upgrade--user-vcSg|] }|dqSrr rZpr r r rrz_bootstrap..)Z ValueErrorrZauditrrrtempfileZTemporaryDirectory _PROJECTSr ZopenrrrZwriteZreadZappendr)rrrr r!r"ZtmpdirrZprojectrZpy_tagZ wheel_nameZsfpZfprr r r r#Xs4      J   r#)r"cCsz ddl}Wnty YdS0|jtkrLd}t||jttjddStgd}|rp|dd|g7}t |dd t t DS) z~Helper to support a clean default uninstall process on Windows Note that calling this function may alter os.environ. rNzOensurepip will only uninstall a matching version ({!r} installed, {!r} bundled))Zfile)Z uninstallz-yz--disable-pip-version-checkr'r(cSr)r*r r+r r r rrz%_uninstall_helper..) rZ ImportErrorZ __version__rZprintrrZstderrrrZreversedr-)r"rZmsgrr r r _uninstall_helpers   r.cCsddl}|jdd}|jdddtdd|jd d d dd d d|jdddddd|jddddd|jdddd|jddddd|jddddd||}t|j|j|j |j |j |j dS)Nrzpython -m ensurepip)Zprogz --versionrzpip {}z9Show the version of pip that is bundled with this Python.)actionrhelpz-vz --verboseZcountr"zDGive more output. Option is additive, and can be used up to 3 times.)r/defaultZdestr0z-Ur%Z store_trueFz8Upgrade pip and dependencies, even if already installed.)r/r1r0r&zInstall using the user scheme.r$z=Install everything relative to this alternate root directory.)r1r0z --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.)rrrr"r r!) argparseZArgumentParserZ add_argumentrrZ parse_argsr#rrrr"r r!)Zargvr2Zparserrr r r _mainsj   r3Nr4)Zdistutils.versionr r rZos.pathrZrunpyr,rZ importlibrZ__all__rr rZ_SETUPTOOLS_VERSIONrr-rrrrr#r.r3r r r r Zs<      6