File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed
src/pip/_internal/resolution Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 45
45
from pip ._internal .resolution .base import BaseResolver , InstallRequirementProvider
46
46
from pip ._internal .utils import compatibility_tags
47
47
from pip ._internal .utils .compatibility_tags import get_supported
48
+ from pip ._internal .utils .direct_url_helpers import direct_url_from_link
48
49
from pip ._internal .utils .logging import indent_log
49
50
from pip ._internal .utils .misc import normalize_version_info
50
51
from pip ._internal .utils .packaging import check_requires_python
@@ -431,8 +432,14 @@ def _populate_link(self, req: InstallRequirement) -> None:
431
432
logger .debug ("Using cached wheel link: %s" , cache_entry .link )
432
433
if req .link is req .original_link and cache_entry .persistent :
433
434
req .original_link_is_in_wheel_cache = True
434
- if cache_entry .origin is not None :
435
- req .download_info = cache_entry .origin
435
+ if cache_entry .origin is not None :
436
+ req .download_info = cache_entry .origin
437
+ else :
438
+ # Legacy cache entry that does not have origin.json.
439
+ # download_info may miss the archive_info.hash field.
440
+ req .download_info = direct_url_from_link (
441
+ req .link , link_is_in_wheel_cache = True
442
+ )
436
443
req .link = cache_entry .link
437
444
438
445
def _get_dist_for (self , req : InstallRequirement ) -> BaseDistribution :
Original file line number Diff line number Diff line change 18
18
install_req_from_line ,
19
19
)
20
20
from pip ._internal .req .req_install import InstallRequirement
21
+ from pip ._internal .utils .direct_url_helpers import direct_url_from_link
21
22
from pip ._internal .utils .misc import normalize_version_info
22
23
23
24
from .base import Candidate , CandidateVersion , Requirement , format_name
@@ -281,14 +282,17 @@ def __init__(
281
282
version , wheel_version , name
282
283
)
283
284
284
- if (
285
- cache_entry is not None
286
- and cache_entry .persistent
287
- and template .link is template .original_link
288
- ):
289
- ireq .original_link_is_in_wheel_cache = True
285
+ if cache_entry is not None :
286
+ if cache_entry .persistent and template .link is template .original_link :
287
+ ireq .original_link_is_in_wheel_cache = True
290
288
if cache_entry .origin is not None :
291
289
ireq .download_info = cache_entry .origin
290
+ else :
291
+ # Legacy cache entry that does not have origin.json.
292
+ # download_info may miss the archive_info.hash field.
293
+ ireq .download_info = direct_url_from_link (
294
+ source_link , link_is_in_wheel_cache = True
295
+ )
292
296
293
297
super ().__init__ (
294
298
link = link ,
You can’t perform that action at this time.
0 commit comments