summaryrefslogtreecommitdiff
path: root/src/pip/_internal/req/req_install.py
diff options
context:
space:
mode:
authorStéphane Bidoul <stephane.bidoul@gmail.com>2023-04-15 11:38:38 +0200
committerGitHub <noreply@github.com>2023-04-15 11:38:38 +0200
commitdbf4e6842c9603792f6d3944a5c9cec17bd0a92a (patch)
treea9e4630d04fa03dea335d5a93a6041cf736c0bde /src/pip/_internal/req/req_install.py
parentf7787f8798712e475ebbf71f5487f92158f043a9 (diff)
parentefe2d27451d50b165df78093bf5885da713fbdf8 (diff)
downloadpip-dbf4e6842c9603792f6d3944a5c9cec17bd0a92a.tar.gz
Merge pull request #11897 from sbidoul/cache-hash-checking-sbi
Support wheel cache when using --require-hashes
Diffstat (limited to 'src/pip/_internal/req/req_install.py')
-rw-r--r--src/pip/_internal/req/req_install.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index e2353f032..a0ea58bd1 100644
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -108,7 +108,11 @@ class InstallRequirement:
# PEP 508 URL requirement
link = Link(req.url)
self.link = self.original_link = link
- self.original_link_is_in_wheel_cache = False
+
+ # When this InstallRequirement is a wheel obtained from the cache of locally
+ # built wheels, this is the source link corresponding to the cache entry, which
+ # was used to download and build the cached wheel.
+ self.cached_wheel_source_link: Optional[Link] = None
# Information about the location of the artifact that was downloaded . This
# property is guaranteed to be set in resolver results.
@@ -437,6 +441,12 @@ class InstallRequirement:
return False
return self.link.is_wheel
+ @property
+ def is_wheel_from_cache(self) -> bool:
+ # When True, it means that this InstallRequirement is a local wheel file in the
+ # cache of locally built wheels.
+ return self.cached_wheel_source_link is not None
+
# Things valid for sdists
@property
def unpacked_source_directory(self) -> str: