U v_]1@sNdZddlmZddlmZmZmZddlmZddl m Z e rddl m Z m Z mZmZmZddlmZddlmZmZdd lmZdd lmZdd lmZerdd lmZn dd lmZGdddeZGdddeZ GdddeZ!GdddeZ"GdddeZ#Gddde!Z$Gddde!Z%GdddeZ&GdddeZ'Gd d!d!eZ(Gd"d#d#eZ)Gd$d%d%eZ*Gd&d'd'eZ+Gd(d)d)e!Z,Gd*d+d+e!Z-Gd,d-d-e!Z.Gd.d/d/e!Z/Gd0d1d1e!Z0Gd2d3d3e0Z1Gd4d5d5e0Z2Gd6d7d7e0Z3Gd8d9d9e0Z4Gd:d;d;e0Z5Gdd?d?e Z7d@S)Az"Exceptions used throughout package)absolute_import)chaingroupbyrepeat) iteritems)MYPY_CHECK_RUNNING)AnyOptionalListDictText) Distribution)ResponseRequest)PY3) configparser)InstallRequirement)_Hash)_hashc@seZdZdZdS)PipErrorzBase pip exceptionN__name__ __module__ __qualname____doc__rr/builddir/build/BUILDROOT/alt-python38-pip-20.2.4-1.el7.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/exceptions.pyrsrc@seZdZdZdS)ConfigurationErrorz"General exception in configurationNrrrrrrsrc@seZdZdZdS)InstallationErrorz%General exception during installationNrrrrrr#src@seZdZdZdS)UninstallationErrorz'General exception during uninstallationNrrrrrr'src@s eZdZdZddZddZdS)NoneMetadataErrora Raised when accessing "METADATA" or "PKG-INFO" metadata for a pip._vendor.pkg_resources.Distribution object and `dist.has_metadata('METADATA')` returns True but `dist.get_metadata('METADATA')` returns None (and similarly for "PKG-INFO"). cCs||_||_dS)z :param dist: A Distribution object. :param metadata_name: The name of the metadata being accessed (can be "METADATA" or "PKG-INFO"). N)dist metadata_name)selfr!r"rrr__init__4szNoneMetadataError.__init__cCsd|j|jS)Nz+None {} metadata found for distribution: {})formatr"r!r#rrr__str__>s zNoneMetadataError.__str__Nrrrrr$r'rrrrr +s r c@seZdZdZdS)DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementNrrrrrr)Isr)c@seZdZdZdS)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.Nrrrrrr*Msr*c@seZdZdZdS)BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already installed.Nrrrrrr+Qsr+c@seZdZdZdS) BadCommandz0Raised when virtualenv or a command is not foundNrrrrrr,Vsr,c@seZdZdZdS) CommandErrorz7Raised when there is an error in command-line argumentsNrrrrrr-Zsr-c@seZdZdZdS)SubProcessErrorzPRaised when there is an error raised while executing a command in subprocessNrrrrrr.^sr.c@seZdZdZdS)PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryNrrrrrr/csr/cs*eZdZdZdfdd ZddZZS)NetworkConnectionErrorzHTTP connection errorNcsN||_||_||_|jdk r6|js6t|dr6|jj|_tt||||dS)zc Initialize NetworkConnectionError with `request` and `response` objects. Nrequest)responser1 error_msghasattrsuperr0r$)r#r3r2r1 __class__rrr$js  zNetworkConnectionError.__init__cCs t|jSN)strr3r&rrrr'yszNetworkConnectionError.__str__)NNrrrrr$r' __classcell__rrr6rr0gsr0c@seZdZdZdS)InvalidWheelFilenamezInvalid wheel filename.Nrrrrrr<~sr<c@seZdZdZdS)UnsupportedWheelzUnsupported wheel.Nrrrrrr=sr=c@s eZdZdZddZddZdS)MetadataInconsistentzBuilt metadata contains inconsistent information. This is raised when the metadata contains values (e.g. name and version) that do not match the information previously obtained from sdist filename or user-supplied ``#egg=`` value. cCs||_||_||_dSr8)ireqfieldbuilt)r#r?r@rArrrr$szMetadataInconsistent.__init__cCsd|j|j|jS)Nz/Requested {} has different {} in metadata: {!r})r%r?r@rAr&rrrr's zMetadataInconsistent.__str__Nr(rrrrr>sr>c@s8eZdZdZddZddZddZdd Zd d Zd S) HashErrorsz:Multiple HashError instances rolled into one for reportingcCs g|_dSr8)errorsr&rrrr$szHashErrors.__init__cCs|j|dSr8)rCappend)r#errorrrrrDszHashErrors.appendcCsbg}|jjdddt|jddD](\}}||j|dd|Dq&|r^d|SdS) NcSs|jSr8)ordererrrz$HashErrors.__str__..)keycSs|jSr8r6rGrrrrIrJcss|]}|VqdSr8)body.0rHrrr sz%HashErrors.__str__.. )rCsortrrDheadextendjoin)r#linescls errors_of_clsrrrr's  zHashErrors.__str__cCs t|jSr8)boolrCr&rrr __nonzero__szHashErrors.__nonzero__cCs|Sr8)rZr&rrr__bool__szHashErrors.__bool__N) rrrrr$rDr'rZr[rrrrrBs  rBc@s4eZdZdZdZdZdZddZddZdd Z dS) HashErrora A failure to verify a package against known-good hashes :cvar order: An int sorting hash exception classes by difficulty of recovery (lower being harder), so the user doesn't bother fretting about unpinned packages when he has deeper issues, like VCS dependencies, to deal with. Also keeps error reports in a deterministic order. :cvar head: A section heading for display above potentially many exceptions of this kind :ivar req: The InstallRequirement that triggered this error. This is pasted on after the exception is instantiated, because it's not typically available earlier. NrQcCsd|S)a=Return a summary of me for display under the heading. This default implementation simply prints a description of the triggering requirement. :param req: The InstallRequirement that provoked this error, with its link already populated by the resolver's _populate_link(). z {})r%_requirement_namer&rrrrLs zHashError.bodycCsd|j|S)Nz{} {})r%rSrLr&rrrr'szHashError.__str__cCs|jrt|jSdS)zReturn a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers unknown package)reqr9r&rrrr]szHashError._requirement_name) rrrrr_rSrFrLr'r]rrrrr\s r\c@seZdZdZdZdZdS)VcsHashUnsupporteduA hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.rzlCan't verify hashes for these requirements because we don't have a way to hash version control repositories:NrrrrrFrSrrrrr`sr`c@seZdZdZdZdZdS)DirectoryUrlHashUnsupportedrazUCan't verify hashes for these file:// requirements because they point to directories:Nrbrrrrrcsrcc@s(eZdZdZdZdZddZddZdS) HashMissingz2A hash was needed for a requirement but is absent.awHashes are required in --require-hashes mode, but they are missing from some requirements. Here is a list of those requirements along with the hashes their downloaded archives actually had. Add lines like these to your requirements files to prevent tampering. (If you did not enable --require-hashes manually, note that it turns on automatically when any package has a hash.)cCs ||_dS)zq :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded N) gotten_hash)r#rgrrrr$szHashMissing.__init__cCsHddlm}d}|jr4|jjr&|jjn t|jdd}d|p>d||jS)Nr) FAVORITE_HASHr_z {} --hash={}:{}r^)pip._internal.utils.hashesrhr_ original_linkgetattrr%rg)r#rhpackagerrrrLs   zHashMissing.bodyN)rrrrrFrSr$rLrrrrres rec@seZdZdZdZdZdS) HashUnpinnedzPA requirement had a hash specified but was not pinned to a specific version.zaIn --require-hashes mode, all requirements must have their versions pinned with ==. These do not:Nrbrrrrrm"srmc@s0eZdZdZdZdZddZddZdd Zd S) HashMismatchz Distribution file hash values don't match. :ivar package_name: The name of the package that triggered the hash mismatch. Feel free to write to this after the exception is raise to improve its error message. zTHESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.cCs||_||_dS)z :param allowed: A dict of algorithm names pointing to lists of allowed hex digests :param gots: A dict of algorithm names pointing to hashes we actually got from the files under suspicion N)allowedgots)r#rqrrrrrr$:szHashMismatch.__init__cCsd||S)Nz {}: {})r%r]_hash_comparisonr&rrrrLEs zHashMismatch.bodycsddd}g}t|jD]B\}}|||fdd|D|d|j|qd|S)aE Return a comparison of actual and expected hash values. Example:: Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde or 123451234512345123451234512345123451234512345 Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef cSst|gtdS)Nz or)rr) hash_namerrr hash_then_orVsz3HashMismatch._hash_comparison..hash_then_orc3s|]}dt|VqdS)z Expected {} {}N)r%nextrMprefixrrrO_sz0HashMismatch._hash_comparison..z Got {} rP)rrqrTrDr%rr hexdigestrU)r#rurVrt expectedsrrwrrsJs  zHashMismatch._hash_comparisonN) rrrrrFrSr$rLrsrrrrro+s  roc@seZdZdZdS)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.Nrrrrrr{fsr{cs*eZdZdZdfdd ZddZZS) !ConfigurationFileCouldNotBeLoadedz=When there are errors while loading a configuration file could not be loadedNcs&tt||||_||_||_dSr8)r5r|r$reasonfnamerE)r#r~rrEr6rrr$osz*ConfigurationFileCouldNotBeLoaded.__init__cCs@|jdk rd|j}n|jdk s&td|j}d|j|S)Nz in {}.z. {} zConfiguration file {}{})rr%rEAssertionErrorr~)r# message_partrrrr'vs   z)ConfigurationFileCouldNotBeLoaded.__str__)r}NNr:rrr6rr|ksr|N)8r __future__r itertoolsrrrZpip._vendor.sixrpip._internal.utils.typingrtypingrr r r r Zpip._vendor.pkg_resourcesr Zpip._vendor.requests.modelsrrrpip._vendor.six.movesrZpip._internal.req.req_installrhashlibrr Exceptionrrrrr r)r*r+r,r-r.r/r0r<r=r>rBr\r`rcrermror{r|rrrrsN        0  ' ;