f _@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{}*{})key)ospathjoin _WHEEL_DIRformat_wheelsgloblenbasenamestrmax distutilsrZ LooseVersion)pkgprefixsuffixpatternrZ 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)check) subprocessrunsys executable returncode)argsadditional_pathscoderrr_run_pip(s r#cCstS)zA Returns a string specifying the bundled version of pip. ) _PIP_VERSIONrrrrr7scCs2ddtjD}|D] }tj|=qtjtjd<dS)NcSsg|]}|dr|qS)ZPIP_) startswith).0krrr Az7_disable_pip_configuration_settings..ZPIP_CONFIG_FILE)renvirondevnull)Zkeys_to_remover'rrr#_disable_pip_configuration_settings=s r,Frootupgradeuser 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. r-N) _bootstrapr-rrrrIs 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.bootstrapr1ZENSUREPIP_OPTIONSinstallrbwbNz--no-cache-dirz --no-indexz --find-links--root --upgrade--user-vcSsg|] }|dqSrrr&prrrr(r)z_bootstrap..) ValueErrorrauditr,rr*tempfileTemporaryDirectory _PROJECTSr openrrr writereadappendr#)r.r/r0r1r2r3Ztmpdirr!ZprojectrZpy_tagZ wheel_nameZsfpfpr rrrr4Xs4      J   r4)r3cCsz 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))file)Z uninstallz-yz--disable-pip-version-checkr;r<cSsg|] }|dqSr=rr>rrrr(r)z%_uninstall_helper..) r ImportError __version__r$printr rstderrr,r#reversedrD)r3rmsgr rrr_uninstall_helpers   rQcCsddl}|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 --verbosecountr3zDGive more output. Option is additive, and can be used up to 3 times.)rSdefaultdestrTz-Ur9 store_trueFz8Upgrade pip and dependencies, even if already installed.)rSrVrTr:zInstall using the user scheme.r8z=Install everything relative to this alternate root directory.)rVrTz --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.)r.r/r0r3r1r2) argparseArgumentParser add_argumentr r parse_argsr4r.r/r0r3r1r2)argvrYparserr rrr_mainsj   r_)N)N)Zdistutils.versionrr rZos.pathrZrunpyrBr importlibr__all__r r rZ_SETUPTOOLS_VERSIONr$rDr#rr,rr4rQr_rrrrs<      6