Merge pull request #8445 from uranusjr/hash-error-message

Set the requirement context on hash error
This commit is contained in:
Pradyun Gedam 2020-06-24 18:41:03 +05:30 committed by GitHub
commit 439e16f106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,7 @@ from pip._vendor.packaging.specifiers import InvalidSpecifier, SpecifierSet
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.packaging.version import Version
from pip._internal.exceptions import MetadataInconsistent
from pip._internal.exceptions import HashError, MetadataInconsistent
from pip._internal.req.constructors import (
install_req_from_editable,
install_req_from_line,
@ -202,7 +202,12 @@ class _InstallRequirementBackedCandidate(Candidate):
if self._dist is not None:
return
abstract_dist = self._prepare_abstract_distribution()
try:
abstract_dist = self._prepare_abstract_distribution()
except HashError as e:
e.req = self._ireq
raise
self._dist = abstract_dist.get_pkg_resources_distribution()
assert self._dist is not None, "Distribution already installed"