diff options
author | Stéphane Bidoul <stephane.bidoul@gmail.com> | 2023-04-10 14:46:12 +0200 |
---|---|---|
committer | Stéphane Bidoul <stephane.bidoul@gmail.com> | 2023-04-14 08:03:49 +0200 |
commit | bd746e3136e5e1be2374a079bac66071dd967a8c (patch) | |
tree | 899f6b1ca027daae876c3379f98985a26546559c /src | |
parent | caafe6e87d4f2998a77b194297e1c204cf6e10c2 (diff) | |
download | pip-bd746e3136e5e1be2374a079bac66071dd967a8c.tar.gz |
Introduce ireq.cached_wheel_source_link
Diffstat (limited to 'src')
-rw-r--r-- | src/pip/_internal/operations/prepare.py | 5 | ||||
-rw-r--r-- | src/pip/_internal/req/req_install.py | 3 | ||||
-rw-r--r-- | src/pip/_internal/resolution/legacy/resolver.py | 1 | ||||
-rw-r--r-- | src/pip/_internal/resolution/resolvelib/candidates.py | 1 |
4 files changed, 6 insertions, 4 deletions
diff --git a/src/pip/_internal/operations/prepare.py b/src/pip/_internal/operations/prepare.py index 10ed17c19..227331523 100644 --- a/src/pip/_internal/operations/prepare.py +++ b/src/pip/_internal/operations/prepare.py @@ -575,10 +575,7 @@ class RequirementPreparer: "don't match, ignoring cached built wheel " "and re-downloading source." ) - # For some reason req.original_link is not set here, even though - # req.is_wheel_from_cache is True. So we get the original - # link from download_info. - req.link = Link(req.download_info.url) # TODO comes_from? + req.link = req.cached_wheel_source_link link = req.link self._ensure_link_req_src_dir(req, parallel_builds) diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index a8f94d4e0..50d89b1be 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -112,6 +112,9 @@ class InstallRequirement: # 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. + 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. diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py index 86d135fca..216b0b81c 100644 --- a/src/pip/_internal/resolution/legacy/resolver.py +++ b/src/pip/_internal/resolution/legacy/resolver.py @@ -431,6 +431,7 @@ class Resolver(BaseResolver): if cache_entry is not None: 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 diff --git a/src/pip/_internal/resolution/resolvelib/candidates.py b/src/pip/_internal/resolution/resolvelib/candidates.py index 7c2aae3b8..2c315b460 100644 --- a/src/pip/_internal/resolution/resolvelib/candidates.py +++ b/src/pip/_internal/resolution/resolvelib/candidates.py @@ -280,6 +280,7 @@ class LinkCandidate(_InstallRequirementBackedCandidate): assert ireq.link.is_wheel 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 |