diff options
author | Stéphane Bidoul <stephane.bidoul@gmail.com> | 2023-04-14 08:12:33 +0200 |
---|---|---|
committer | Stéphane Bidoul <stephane.bidoul@gmail.com> | 2023-04-14 08:12:33 +0200 |
commit | efe2d27451d50b165df78093bf5885da713fbdf8 (patch) | |
tree | a9e4630d04fa03dea335d5a93a6041cf736c0bde | |
parent | 4beca6b4c9c510b19dbb6180e962425b89e8c839 (diff) | |
download | pip-efe2d27451d50b165df78093bf5885da713fbdf8.tar.gz |
Further refactor is_wheel_from_cache
-rw-r--r-- | src/pip/_internal/req/req_install.py | 14 | ||||
-rw-r--r-- | src/pip/_internal/resolution/legacy/resolver.py | 1 | ||||
-rw-r--r-- | src/pip/_internal/resolution/resolvelib/candidates.py | 1 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index 50d89b1be..a0ea58bd1 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -109,11 +109,9 @@ class InstallRequirement: link = Link(req.url) self.link = self.original_link = link - # When is_wheel_from_cache is True, it means that this InstallRequirement - # is a local wheel file in the cache of locally built wheels. - self.is_wheel_from_cache = False - # When is_wheel_from_cache is True, this is the source link corresponding - # to the cache entry, which was used to download and build the cached wheel. + # 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 @@ -443,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: diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py index 216b0b81c..b17b7e453 100644 --- a/src/pip/_internal/resolution/legacy/resolver.py +++ b/src/pip/_internal/resolution/legacy/resolver.py @@ -432,7 +432,6 @@ class Resolver(BaseResolver): logger.debug("Using cached wheel link: %s", cache_entry.link) if req.link is req.original_link and cache_entry.persistent: req.cached_wheel_source_link = req.link - req.is_wheel_from_cache = True if cache_entry.origin is not None: req.download_info = cache_entry.origin else: diff --git a/src/pip/_internal/resolution/resolvelib/candidates.py b/src/pip/_internal/resolution/resolvelib/candidates.py index 2c315b460..31020e27a 100644 --- a/src/pip/_internal/resolution/resolvelib/candidates.py +++ b/src/pip/_internal/resolution/resolvelib/candidates.py @@ -281,7 +281,6 @@ class LinkCandidate(_InstallRequirementBackedCandidate): assert ireq.link.is_file if cache_entry.persistent and template.link is template.original_link: ireq.cached_wheel_source_link = source_link - ireq.is_wheel_from_cache = True if cache_entry.origin is not None: ireq.download_info = cache_entry.origin else: |