Re]1@s)dZddlmZddlmZmZmZddlmZddl m Z e rddl m Z m Z mZmZmZddlmZddlmZmZdd lmZdd lmZdd lmZerdd lmZndd 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;e0Z5Gd<d=d=e!Z6Gd>d?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-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/exceptions.pyrs rc@seZdZdZdS)ConfigurationErrorz"General exception in configurationN)rrrrrrrrrs rc@seZdZdZdS)InstallationErrorz%General exception during installationN)rrrrrrrrr#s rc@seZdZdZdS)UninstallationErrorz'General exception during uninstallationN)rrrrrrrrr's rc@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__4s zNoneMetadataError.__init__cCsdj|j|jS)Nz+None {} metadata found for distribution: {})formatr!r )r"rrr__str__>szNoneMetadataError.__str__N)rrrrr#r%rrrrr+s  rc@seZdZdZdS)DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementN)rrrrrrrrr&Is r&c@seZdZdZdS)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.N)rrrrrrrrr'Ms r'c@seZdZdZdS)BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already installed.N)rrrrrrrrr(Qs r(c@seZdZdZdS) BadCommandz0Raised when virtualenv or a command is not foundN)rrrrrrrrr)Vs r)c@seZdZdZdS) CommandErrorz7Raised when there is an error in command-line argumentsN)rrrrrrrrr*Zs r*c@seZdZdZdS)SubProcessErrorzPRaised when there is an error raised while executing a command in subprocessN)rrrrrrrrr+^s r+c@seZdZdZdS)PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryN)rrrrrrrrr,cs r,cs:eZdZdZddfddZddZS)NetworkConnectionErrorzHTTP connection errorNcsr||_||_||_|jdk rR|j rRt|drR|jj|_tt|j|||dS)zc Initialize NetworkConnectionError with `request` and `response` objects. Nrequest)responser. error_msghasattrsuperr-r#)r"r0r/r.) __class__rrr#js   zNetworkConnectionError.__init__cCs t|jS)N)strr0)r"rrrr%yszNetworkConnectionError.__str__)rrrrr#r%rr)r3rr-gs r-c@seZdZdZdS)InvalidWheelFilenamezInvalid wheel filename.N)rrrrrrrrr5~s r5c@seZdZdZdS)UnsupportedWheelzUnsupported wheel.N)rrrrrrrrr6s r6c@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||_||_||_dS)N)ireqfieldbuilt)r"r8r9r:rrrr#s  zMetadataInconsistent.__init__cCsdj|j|j|jS)Nz/Requested {} has different {} in metadata: {!r})r$r8r9r:)r"rrrr%szMetadataInconsistent.__str__N)rrrrr#r%rrrrr7s  r7c@sReZdZdZddZddZddZdd Zd d Zd S) HashErrorsz:Multiple HashError instances rolled into one for reportingcCs g|_dS)N)errors)r"rrrr#szHashErrors.__init__cCs|jj|dS)N)r<append)r"errorrrrr=szHashErrors.appendcCsg}|jjdddxPt|jddD]6\}}|j|j|jdd|Dq8W|rdj|SdS) NkeycSs|jS)N)order)errrsz$HashErrors.__str__..cSs|jS)N)r3)rArrrrBscss|]}|jVqdS)N)body).0rArrr sz%HashErrors.__str__.. )r<sortrr=headextendjoin)r"linescls errors_of_clsrrrr%s% zHashErrors.__str__cCs t|jS)N)boolr<)r"rrr __nonzero__szHashErrors.__nonzero__cCs |jS)N)rP)r"rrr__bool__szHashErrors.__bool__N) rrrrr#r=r%rPrQrrrrr;s    r;c@sLeZdZdZdZdZdZddZddZdd 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. NrGcCsdj|jS)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_name)r"rrrrCs zHashError.bodycCsdj|j|jS)Nz{} {})r$rIrC)r"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 zunknown package)reqr4)r"rrrrSszHashError._requirement_name) rrrrrTrIr@rCr%rSrrrrrRs  rRc@s"eZdZdZdZdZdS)VcsHashUnsupportedzuA 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:N)rrrrr@rIrrrrrUs rUc@s"eZdZdZdZdZdS)DirectoryUrlHashUnsupportedzuA hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.zUCan't verify hashes for these file:// requirements because they point to directories:N)rrrrr@rIrrrrrVs rVc@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"rZrrrr#szHashMissing.__init__cCshddlm}d}|jrL|jjr7|jjnt|jdd}dj|p[d||jS)Nr) FAVORITE_HASHrTz {} --hash={}:{}zunknown package)pip._internal.utils.hashesr[rT original_linkgetattrr$rZ)r"r[packagerrrrCs zHashMissing.bodyN)rrrrr@rIr#rCrrrrrXs  rXc@s"eZdZdZdZdZdS) 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:N)rrrrr@rIrrrrr`"s r`c@sFeZdZdZdZdZddZddZdd 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"rdrerrrr#:s zHashMismatch.__init__cCsdj|j|jS)Nz {}: {})r$rS_hash_comparison)r"rrrrCEszHashMismatch.bodycsdd}g}xlt|jD][\}}|||jfdd|D|jdj|j|jq"Wdj|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'|]}djt|VqdS)z Expected {} {}N)r$next)rDrA)prefixrrrE_sz0HashMismatch._hash_comparison..z Got {} rF)rrdrJr=r$re hexdigestrK)r"rhrLrg expectedsr)rjrrfJs    zHashMismatch._hash_comparisonN) rrrrr@rIr#rCrfrrrrrb+s  rbc@seZdZdZdS)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.N)rrrrrrrrrmfs rmcs=eZdZdZdddfddZddZS)!ConfigurationFileCouldNotBeLoadedz=When there are errors while loading a configuration file zcould not be loadedNcs5tt|j|||_||_||_dS)N)r2rnr#reasonfnamer>)r"rorpr>)r3rrr#os  z*ConfigurationFileCouldNotBeLoaded.__init__cCs^|jdk r$dj|j}n'|jdk s9tdj|j}dj|j|S)Nz in {}.z. {} zConfiguration file {}{})rpr$r>AssertionErrorro)r" message_partrrrr%vs z)ConfigurationFileCouldNotBeLoaded.__str__)rrrrr#r%rr)r3rrnks rnN)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 Exceptionrrrrrr&r'r(r)r*r+r,r-r5r6r7r;rRrUrVrXr`rbrmrnrrrrsN(0  ' ;