U 巀g[@s&ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddlmZddlmZddlmZmZmZddlmZddlmZmZddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0dd l1m2Z2m3Z3dd l4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;ddddddddddddddgZZ?e(dZ@e&e'eAeAefZBe&eCeCeCfZDe&eEe&e$eEe$eEffZFeeeeAgefZGeeeeBgefZHd ZIeEd!d"d#ZJe&eCd$fe&eCeCeCfd%d&d'ZKeEdd(d)dZLeEd!d*dZMe9d+d,d-deEeNe$eGdd/d0dZOedd1d2d3ZPedd1d4d5ZQeQd6eee)eBeAfeGdd7d8d9ZReEeEd(d:dZSdeEeEeEd<d=dZTeEe!eEeEd>d?d@ZUeEddAdBdCZVeEe!eEeEd>dDdZWeEeEdAdEdFZXeEeEdAdGdHZYeEeCdIdJdKZZe[eEdLdMdZ\e!e!ee&e#eEe#eCfdNdOdPZ]eEeNd(dQdZ^eIfeeCe e_ddfdRdSdTZ`deEeNeEdVdWdZaeEe&eEeEfd(dXdZbeEeEddYdZdZceEeNd(d[d\Zdeedd]d^d_ZeGd`dadaeZfeee'edbdcddZgeEe$eCeEdedfdgZhdeEeEeEdidjdkZieEe&e$eEe$eCfdldmdnZjeEeFdldodpZkeEeEdldqdrZleEeeEge&ed$ffe&eEeFfdsdtduZmeEeFdldvdwZneEe&eEdldxdyZoeEe&eEeEe&e$eEe$eEffdzd{d|ZpeEeEdzd}dZqeEeEdzd~dZre,eEdddZse dUdGdddZteEetdddZueEetdzddZveNddddZwdd!ddZxeNd!ddZydeEeCe&eeCfdddZze!ee"e&eefdddZ{ee@geNfe!e@e&e!e@e!e@fdddZ|Gddde.Z}dd!ddZ~dS)N) dataclass)partial)StringIO) filterfalsetee zip_longest)Path) FunctionType TracebackType)AnyBinaryIOCallableDict GeneratorIterableIteratorListOptionalTextIOTupleTypeTypeVarUnioncast) Requirement)BuildBackendHookCaller) __version__) CommandErrorExternallyManagedEnvironment)get_major_minor_version)WINDOWS)retry)running_under_virtualenvrmtree display_path backup_dirasksplitext format_sizeis_installable_dirnormalize_pathrenamesget_prog ensure_dirremove_auth_from_urlcheck_externally_managed ConfiguredBuildBackendHookCallerTreturncCs>tjtjtdd}tj|}dtd|dtdS)Nz..zpip z from z (python ))ospathjoindirname__file__abspathrr) pip_pkg_dirr=F/opt/hc_python/lib/python3.8/site-packages/pip/_internal/utils/misc.pyget_pip_versionKs r?.)py_version_infor4cCsDt|dkr"|dt|d7}nt|dkr:|dd}td|S)ax Convert a tuple of ints representing a Python version to one of length three. :param py_version_info: a tuple of ints representing a Python version, or None to specify no version. The tuple can have any length. :return: a tuple of length three if `py_version_info` is non-None. Otherwise, return `py_version_info` unchanged (i.e. None). )rN VersionInfo)lenr)r@r=r=r>normalize_version_infoRs   rD)r7r4c CsPzt|Wn<tk rJ}z|jtjkr:|jtjkr:W5d}~XYnXdS)z os.path.makedirs without EEXIST.N)r6makedirsOSErrorerrnoEEXIST ENOTEMPTY)r7er=r=r>r-es c CsRz2tjtjd}|dkr*tjdWS|WSWntttfk rLYnXdS)Nr)z __main__.pyz-cz -m pippip) r6r7basenamesysargv executableAttributeError TypeError IndexError)progr=r=r>r,os rAg?)stop_after_delaywaitF)dir ignore_errorsonexcr4cCsL|rt}|dkrt}tt|d}tjdkr:tj||dntj||ddS)NrX)rA )onerror)_onerror_ignore_onerror_reraiserrmtree_errorhandlerrM version_infoshutilr#)rVrWrXhandlerr=r=r>r#|s  )_argsr4cGsdSNr=rbr=r=r>r\sr\cGsdSrcr=rdr=r=r>r]sr]rY)funcr7exc_inforXr4cCszt|j}Wntk r&YdSX|tj@szt||tjBWntk r\Yn&Xz||WdStk rYnXt|ts|\}}}||||dS)a1 `rmtree` error handler to 'force' a file remove (i.e. like `rm -f`). * If a file is readonly then it's write flag is set and operation is retried. * `onerror` is the original callback from `rmtree(... onerror=onerror)` that is chained at the end if the "rm -f" still fails. N)r6statst_moderFS_IWRITEchmod isinstance BaseException)rer7rfrXrh_r=r=r>r^s"   r^cCsFtjtj|}|ttjjrBd|ttd}|S)zTGives the display value for a given path, making it relative to cwd if possible..N)r6r7normcaser; startswithgetcwdseprCr7r=r=r>r$s.bak)rVextr4cCs6d}|}tj||r.|d7}|t|}q||S)z\Figure out the name of a directory to back up the given dir to (adding .bak, .bak2, etc))r6r7existsstr)rVrun extensionr=r=r>r%s )messageoptionsr4cCs2tjddD]}||kr|Sqt||S)NPIP_EXISTS_ACTION)r6environgetsplitr&)r{r|actionr=r=r>ask_path_existss r)r{r4cCstjdrtd|dS)z&Raise an error if no input is allowed. PIP_NO_INPUTz5No input was expected ($PIP_NO_INPUT set); question: N)r6rr Exceptionr{r=r=r>_check_no_inputs rcCsFt|t|}|}||krYour response ({!r}) was not one of the expected responses: {}z, N)rinputstriplowerprintformatr8)r{r|responser=r=r>r&s cCst|t|S)zAsk for input interactively.)rrrr=r=r> ask_inputsrcCst|t|S)z!Ask for a password interactively.)rgetpassrr=r=r> ask_passwordsr)valr4cCs2|}|dkrdS|dkr dStd|dS)zConvert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 'val' is anything else. )yyesttrueon1rv)rynoffalseoff0rzinvalid truth value N)r ValueError)rr=r=r> strtobools r)bytesr4cCs`|dkr|ddddS|dkr6t|ddS|dkrN|dddSt|dSdS) Ni@Bg@@iz.1fz MBi'z kBz bytes)int)rr=r=r>r( s)rowsr4cs@dd|D}ddt|ddiDfdd|D}|fS)zReturn a list of formatted rows and a list of column sizes. For example:: >>> tabulate([['foobar', 2000], [0xdeadbeef]]) (['foobar 2000', '3735928559'], [10, 4]) cSsg|]}ttt|qSr=)tuplemaprx.0rowr=r=r> sztabulate..cSsg|]}ttt|qSr=)maxrrC)rcolr=r=r>rs fillvaluer~cs$g|]}dttj|qS) )r8rrxljustrstriprsizesr=r>r s)r)rtabler=rr>tabulatesrcCsHtj|sdStjtj|dr*dStjtj|drDdSdS)atIs path is a directory containing pyproject.toml or setup.py? If pyproject.toml exists, this is a PEP 517 project. Otherwise we look for a legacy setuptools layout by identifying setup.py. We don't check for the setup.cfg because using it without setup.py is only available for PEP 517 projects, which are already covered by the pyproject.toml check. Fzpyproject.tomlTzsetup.py)r6r7isdirisfiler8rsr=r=r>r)$s )filesizer4ccs||}|sq|VqdS)z7Yield pieces of data from a file-like object until EOF.N)read)rrchunkr=r=r> read_chunks5s rT)r7resolve_symlinksr4cCs6tj|}|rtj|}n tj|}tj|S)zN Convert a path to its canonical, case-normalized, absolute version. )r6r7 expanduserrealpathr;ro)r7rr=r=r>r*@s   cCs@t|\}}|dr8|dd|}|dd}||fS)z,Like os.path.splitext, but take off .tar tooz.tarN) posixpathr'rendswith)r7baserur=r=r>r'Ms  )oldnewr4cCsztj|\}}|r.|r.tj|s.t|t||tj|\}}|rv|rvzt|Wntk rtYnXdS)z7Like os.renames(), but handles renaming across devices.N) r6r7rrwrEr`move removedirsrF)rrheadtailr=r=r>r+Vs  cCsts dS|ttjS)z Return True if path is within sys.prefix, if we're running in a virtualenv. If we're not in a virtualenv, all paths are considered "local." Caution: this function assumes the head of path has been normalized with normalize_path. T)r"rpr*rMprefixrsr=r=r>is_localgs r)msgargsr4cGstj|f|dSrc)loggerinfo)rrr=r=r> write_outputusrc@s<eZdZUeed<eeddddZeedddZ dS) StreamWrapper orig_stream)rr4cCs|}||_|Src)r)clsrretr=r=r> from_stream|szStreamWrapper.from_streamr3cCs|jjSrc)rencodingselfr=r=r>rszStreamWrapper.encodingN) __name__ __module__ __qualname__r__annotations__ classmethodrpropertyrxrr=r=r=r>rys r) sequentialnamedr4cOs@tt|tt|f|}dd|D}||d<tdd|S)NcSsi|]\}}||qSr=r=)rkeyvaluer=r=r> szenum..reverse_mappingEnumr=)dictziprangerCitemstype)rrenumsreverser=r=r>enumsr)hostportr4cCs.|dkr |Sd|kr d|d}|d|S)z. Build a netloc from a host-port pair N:[]r=)rrr=r=r> build_netlocs  rhttps)netlocschemer4cCs8|ddkr*d|kr*d|kr*d|d}|d|S)z) Build a full URL from a netloc. r@rrz://)count)rrr=r=r>build_url_from_netlocs r)rr4cCs t|}tj|}|j|jfS)z2 Return the host-port pair from a netloc. )rurllibparseurlparsehostnamer)rurlparsedr=r=r> parse_netlocs rcCstd|kr|dfS|dd\}}d}d|kr>|dd\}}n |d}}tj|}|dk rhtj|}|||ffS)zp Parse out and remove the auth information from a netloc. Returns: (netloc, (username, password)). r)NNrvNr)rsplitrrrunquote)rauthpwuserr=r=r>split_auth_from_netlocs   rcCsPt|\}\}}|dkr|S|dkr.d}d}ntj|}d}||d|S)z Replace the sensitive data in a netloc with "****", if it exists. For example: - "user:pass@example.com" returns "user:****@example.com" - "accesstoken@example.com" returns "****@example.com" N****r~z:****r)rrrquote)rrpasswordr=r=r> redact_netlocs r)rtransform_netlocr4cCsJtj|}||j}|j|d|j|j|jf}tj|}|t d|fS)aRTransform and replace netloc in a url. transform_netloc is a function taking the netloc and returning a tuple. The first element of this tuple is the new netloc. The entire tuple is returned. Returns a tuple containing the transformed url as item 0 and the original tuple returned by transform_netloc as item 1. r NetlocTuple) rrurlsplitrrr7queryfragment urlunsplitr)rrpurl netloc_tuple url_piecessurlr=r=r>_transform_urls   rcCst|Src)rrr=r=r> _get_netlocsrcCs t|fSrc)rrr=r=r>_redact_netlocsr)rr4cCst|t\}\}}|||fS)z Parse a url into separate netloc, auth, and url with no auth. Returns: (url_without_auth, netloc, (username, password)) rr)rurl_without_authrrr=r=r>split_auth_netloc_from_urlsrcCst|tdS)z7Return a copy of url with 'username:password@' removed.rrrr=r=r>r. scCst|tdS)z.Replace the password in a given url with ****.r)rrrr=r=r>redact_auth_from_urlsr)reqr4cCs&|jst|St||jt|jS)z:Replace the password in a given requirement url with ****.)rrxreplacer)rr=r=r>redact_auth_from_requirementsr)frozenc@sJeZdZUeed<eed<edddZedddZeedd d Z d S) HiddenTextsecretredactedr3cCsdt|dS)Nz )rxrr=r=r>__repr__!szHiddenText.__repr__cCs|jSrcr!rr=r=r>__str__$szHiddenText.__str__)otherr4cCs t|t|k rdS|j|jkS)NF)rr )rr&r=r=r>__eq__(szHiddenText.__eq__N) rrrrxrr#r%r boolr'r=r=r=r>rs r)rr4cCs t|ddS)Nrr$)r)rr=r=r> hide_value1sr)cCst|}t||dS)Nr$)rr)rr!r=r=r>hide_url5sr*) modifying_pipr4cCs|ddtjjdtjjdtjjg}|oDtoDtjtjd|k}|rxtj ddgtjdd}t d d |dS) zProtection of pip.exe from modification on Windows On Windows, any operation modifying pip should be run as: python -m pip ... rKrnrz-mrvNz3To modify pip, please run the following command: {}r) rMr_majorminorr r6r7rLrNrOrrr8)r+ pip_namesshould_show_use_python_msg new_commandr=r=r>(protect_pip_from_modification_on_windows:s r1cCs<tr dStjtdd}tj|s.dSt|dS)zCheck whether the current environment is externally managed. If the ``EXTERNALLY-MANAGED`` config file is found, the current environment is considered externally managed, and an ExternallyManagedEnvironment is raised. NstdlibzEXTERNALLY-MANAGED) r"r6r7r8 sysconfigget_pathrr from_config)markerr=r=r>r/Ts  cCstjdk otjS)zIs this console interactive?N)rMstdinisattyr=r=r=r>is_console_interactivecsr9)r7 blocksizer4c CsRt}d}t|d.}t||dD]}|t|7}||q$W5QRX||fS)z5Return (hash, length) for path using hashlib.sha256()rrb)r)hashlibsha256openrrCupdate)r7r:hlengthrblockr=r=r> hash_filehs  rC)iterabler4cCst|}t||S)zb Return paired elements. For example: s -> (s0, s1), (s2, s3), (s4, s5), ... )iterr)rDr=r=r>pairwisetsrF)predrDr4cCs t|\}}t||t||fS)z Use a predicate to partition entries into false entries and true entries, like partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 )rrfilter)rGrDt1t2r=r=r> partitions rKc seZdZdeeeeeeedeedfdd Zdeeeee ee effeeedfdd Z deeeee ee effed fd d Z deeeee ee effeeedfd d Z deeee ee effe edfdd Zd eeee ee effe edfdd Zd!eeee ee effe edfdd Zd"eeeee ee effeedfdd Zd#eeeee ee effeedfdd ZZS)$r0N).N) config_holder source_dir build_backend backend_pathrunnerpython_executablecst|||||||_dSrc)super__init__rL)rrLrMrNrOrPrQ __class__r=r>rSs z)ConfiguredBuildBackendHookCaller.__init__)wheel_directoryconfig_settingsmetadata_directoryr4cs|jj}tj|||dSN)rWrX)rLrWrR build_wheelrrVrWrXcsrTr=r>rZs z,ConfiguredBuildBackendHookCaller.build_wheel)sdist_directoryrWr4cs|jj}tj||dSN)rW)rLrWrR build_sdist)rr]rWr\rTr=r>r_sz,ConfiguredBuildBackendHookCaller.build_sdistcs|jj}tj|||dSrY)rLrWrRbuild_editabler[rTr=r>r`s z/ConfiguredBuildBackendHookCaller.build_editable)rWr4cs|jj}tj|dSr^)rLrWrRget_requires_for_build_wheelrrWr\rTr=r>rasz=ConfiguredBuildBackendHookCaller.get_requires_for_build_wheelcs|jj}tj|dSr^)rLrWrRget_requires_for_build_sdistrbrTr=r>rcsz=ConfiguredBuildBackendHookCaller.get_requires_for_build_sdistcs|jj}tj|dSr^)rLrWrRget_requires_for_build_editablerbrTr=r>rdsz@ConfiguredBuildBackendHookCaller.get_requires_for_build_editableT)rXrW_allow_fallbackr4cs|jj}tj|||dSN)rXrWre)rLrWrR prepare_metadata_for_build_wheelrrXrWrer\rTr=r>rgs zAConfiguredBuildBackendHookCaller.prepare_metadata_for_build_wheelcs|jj}tj|||dSrf)rLrWrR#prepare_metadata_for_build_editablerhrTr=r>ris zDConfiguredBuildBackendHookCaller.prepare_metadata_for_build_editable)NNN)NN)N)NN)N)N)N)NT)NT)rrrr rxrr rSrrrrZr_r`rarcrdr(rgri __classcell__r=r=rTr>r0s    cCsNtr dSttdsdStjdks,tjdkr0dStdkr@dStddS)zOutput a warning for sudo users on Unix. In a virtual environment, sudo pip still writes to virtualenv. On Windows, users may run pip as Administrator without issues. This warning only applies to Unix root users outside of virtualenv. Ngetuidwin32cygwinraaRunning pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.)r"hasattrr6rMplatformrkrwarningr=r=r=r>warn_if_run_as_roots  rq)FN)rt)T)r)r2)rGrr<loggingr6rr`rgrMr3 urllib.parser dataclassesr functoolsrior itertoolsrrrpathlibrtypesr r typingr r r rrrrrrrrrrrr"pip._vendor.packaging.requirementsrpip._vendor.pyproject_hooksrrKrpip._internal.exceptionsrrpip._internal.locationsrpip._internal.utils.compatr pip._internal.utils.retryr!pip._internal.utils.virtualenvr"__all__ getLoggerrrr1rlExcInforrBrxr OnExcOnErrFILE_CHUNK_SIZEr?rDr-r,r(r#r\r]r^r$r%rrr&rrrfloatr(rr)rrr*r'r+rrrrrrrrrrrrrr.rrrr)r*r1r/r9rCrFrKr0rqr=r=r=r>s    D        "     )   (         Z