a Re1@s4dZddlZddlmZmZmZddlmZmZm Z m Z m Z ddl m Z ddlmZmZerddlmZddlmZdd lmZGd d d eZGd d d eZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZ GdddeZ!GdddeZ"Gd d!d!eZ#Gd"d#d#eZ$Gd$d%d%eZ%Gd&d'd'eZ&Gd(d)d)eZ'Gd*d+d+eZ(Gd,d-d-eZ)Gd.d/d/eZ*Gd0d1d1eZ+Gd2d3d3e+Z,Gd4d5d5e+Z-Gd6d7d7e+Z.Gd8d9d9e+Z/Gd:d;d;e+Z0Gdd?d?eZ2dS)@z"Exceptions used throughout packageN)chaingroupbyrepeat) TYPE_CHECKINGDictListOptionalUnion) Distribution)RequestResponse)_Hash)BaseDistribution)InstallRequirementc@seZdZdZdS)PipErrorzBase pip exceptionN__name__ __module__ __qualname____doc__rr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/exceptions.pyrsrc@seZdZdZdS)ConfigurationErrorz"General exception in configurationNrrrrrrsrc@seZdZdZdS)InstallationErrorz%General exception during installationNrrrrrrsrc@seZdZdZdS)UninstallationErrorz'General exception during uninstallationNrrrrrrsrc@s8eZdZdZeedfeddddZeddd ZdS) 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"). rN)dist metadata_namereturncCs||_||_dS)z :param dist: A Distribution object. :param metadata_name: The name of the metadata being accessed (can be "METADATA" or "PKG-INFO"). N)rr)selfrrrrr__init__*s zNoneMetadataError.__init__rcCsd|j|jS)Nz+None {} metadata found for distribution: {})formatrrrrrr__str__7szNoneMetadataError.__str__) rrrrr r strr r$rrrrr!s   rc@seZdZdZedddZdS)UserInstallationInvalidzBA --user install is requested on an environment without user site.r!cCsdS)Nz$User base directory is not specifiedrr#rrrr$CszUserInstallationInvalid.__str__N)rrrrr%r$rrrrr&@sr&c@seZdZedddZdS)InvalidSchemeCombinationr!cCs6ddd|jddD}d|d|jddS)Nz, css|]}t|VqdSN)r%).0arrr Iz3InvalidSchemeCombination.__str__..z Cannot set z and z together)joinargs)rbeforerrrr$Hsz InvalidSchemeCombination.__str__N)rrrr%r$rrrrr'Gsr'c@seZdZdZdS)DistributionNotFoundzCRaised when a distribution cannot be found to satisfy a requirementNrrrrrr1Msr1c@seZdZdZdS)RequirementsFileParseErrorzDRaised when a general error occurs parsing a requirements file line.Nrrrrrr2Qsr2c@seZdZdZdS)BestVersionAlreadyInstalledzNRaised when the most up-to-date version of a package is already installed.Nrrrrrr3Usr3c@seZdZdZdS) BadCommandz0Raised when virtualenv or a command is not foundNrrrrrr4Zsr4c@seZdZdZdS) CommandErrorz7Raised when there is an error in command-line argumentsNrrrrrr5^sr5c@seZdZdZdS)PreviousBuildDirErrorz:Raised when there's a previous conflicting build directoryNrrrrrr6bsr6cs<eZdZdZd eeeddfdd ZedddZZ S) NetworkConnectionErrorzHTTP connection errorN) error_msgresponserequestrcsJ||_||_||_|jdur6|js6t|dr6|jj|_t|||dS)zc Initialize NetworkConnectionError with `request` and `response` objects. Nr:)r9r:r8hasattrsuperr )rr8r9r: __class__rrr is zNetworkConnectionError.__init__r!cCs t|jSr()r%r8r#rrrr${szNetworkConnectionError.__str__)NN) rrrrr%r r r r$ __classcell__rrr=rr7fsr7c@seZdZdZdS)InvalidWheelFilenamezInvalid wheel filename.Nrrrrrr@sr@c@seZdZdZdS)UnsupportedWheelzUnsupported wheel.NrrrrrrAsrAc@s4eZdZdZdeeeddddZeddd ZdS) 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. rN)ireqfieldf_valm_valrcCs||_||_||_||_dSr()rCrDrErF)rrCrDrErFrrrr szMetadataInconsistent.__init__r!cCsd}||j|j|j|jS)NzJRequested {} has inconsistent {}: filename has {!r}, but metadata has {!r})r"rCrDrErF)rtemplaterrrr$szMetadataInconsistent.__str__)rrrrr%r r$rrrrrBs  rBc@s0eZdZdZeeddddZedddZdS) InstallationSubprocessErrorz-A subprocess call failed during installation.N) returncode descriptionrcCs||_||_dSr()rIrJ)rrIrJrrrr sz$InstallationSubprocessError.__init__r!cCsd|j|jS)NzSCommand errored out with exit status {}: {} Check the logs for full command output.)r"rIrJr#rrrr$sz#InstallationSubprocessError.__str__)rrrrintr%r r$rrrrrHsrHc@sJeZdZdZddddZddddd Zedd d Zedd d Z dS) HashErrorsz:Multiple HashError instances rolled into one for reportingNr!cCs g|_dSr()errorsr#rrrr szHashErrors.__init__ HashError)errorrcCs|j|dSr()rMappend)rrOrrrrPszHashErrors.appendcCsbg}|jjdddt|jddD](\}}||j|dd|Dq&|r^d|SdS) NcSs|jSr()ordererrrr,z$HashErrors.__str__..)keycSs|jSr(r=rRrrrrTr,css|]}|VqdSr()bodyr)rSrrrr+r,z%HashErrors.__str__.. )rMsortrrPheadextendr.)rlinescls errors_of_clsrrrr$s  zHashErrors.__str__cCs t|jSr()boolrMr#rrr__bool__szHashErrors.__bool__) rrrrr rPr%r$r`rarrrrrLs  rLc@s\eZdZUdZdZeded<dZdZe ed<e dd d Z e dd d Z e dd dZ dS)rNa 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. NrreqrYr-rQr!cCsd|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 )_requirement_namer#rrrrVs zHashError.bodycCs|jd|S)NrX)r[rVr#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)rbr%r#rrrrcszHashError._requirement_name)rrrrrbr__annotations__r[rQrKr%rVr$rcrrrrrNs   rNc@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:NrrrrrQr[rrrrrfsrfc@seZdZdZdZdZdS)DirectoryUrlHashUnsupportedrgzUCan't verify hashes for these file:// requirements because they point to directories:Nrhrrrrrisric@s6eZdZdZdZdZeddddZedd d ZdS) 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.)N) gotten_hashrcCs ||_dS)zq :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded N)rm)rrmrrrr szHashMissing.__init__r!cCsHddlm}d}|jr4|jjr&|jjn t|jdd}d|p>d||jS)Nr) FAVORITE_HASHrbz {} --hash={}:{}rd)pip._internal.utils.hashesrnrb original_linkgetattrr"rm)rrnpackagerrrrVs    zHashMissing.body) rrrrrQr[r%r rVrrrrrks  rkc@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:Nrhrrrrrs2srsc@sZeZdZdZdZdZeeeefeedfddddZ ed d d Z ed d d Z dS) 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.r N)allowedgotsrcCs||_||_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)rwrx)rrwrxrrrr OszHashMismatch.__init__r!cCsd||S)Nz {}: {})r"rc_hash_comparisonr#rrrrVYszHashMismatch.bodycsltdddd}g}|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 z chain[str]) hash_namercSst|gtdS)Nz or)rr)rzrrr hash_then_orhsz3HashMismatch._hash_comparison..hash_then_orc3s|]}dt|VqdS)z Expected {} {}N)r"nextrWprefixrrr+psz0HashMismatch._hash_comparison..z Got {} rX) r%rwitemsr\rPr"rx hexdigestr.)rr{r]rz expectedsrr}rry\s zHashMismatch._hash_comparison) rrrrrQr[rr%rr rVryrrrrru=s & ruc@seZdZdZdS)UnsupportedPythonVersionzMUnsupported python version according to Requires-Python package metadata.NrrrrrrysrcsFeZdZdZd eeeeejddfdd Zeddd Z Z S) !ConfigurationFileCouldNotBeLoadedz8When there are errors while loading a configuration filecould not be loadedN)reasonfnamerOrcs"t|||_||_||_dSr()r<r rrrO)rrrrOr=rrr s z*ConfigurationFileCouldNotBeLoaded.__init__r!cCsF|jdurd|jd}n|jdus(Jd|jd}d|j|S)Nz in .z. rXzConfiguration file )rrOr)r message_partrrrr$s  z)ConfigurationFileCouldNotBeLoaded.__str__)rNN) rrrrr%r configparserErrorr r$r?rrr=rr~s r)3rr itertoolsrrrtypingrrrrr pip._vendor.pkg_resourcesr Zpip._vendor.requests.modelsr r hashlibr pip._internal.metadatarZpip._internal.req.req_installr Exceptionrrrrrr&r'r1r2r3r4r5r6r7r@rArBrHrLrNrfrirkrsrurrrrrrsH    .  * <