Skip to content

Commit 4f6d47d

Browse files
committed
Tweak comments
1 parent 5119d46 commit 4f6d47d

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

src/pip/_internal/models/installation_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, install_requirements: Sequence[InstallRequirement]):
1414
def _install_req_to_dict(cls, ireq: InstallRequirement) -> Dict[str, Any]:
1515
assert ireq.download_info, f"No download_info for {ireq}"
1616
res = {
17-
# PEP 610 json for the download URL. download_info.archive_info.hash may
17+
# PEP 610 json for the download URL. download_info.archive_info.hashes may
1818
# be absent when the requirement was installed from the wheel cache
1919
# and the cache entry was populated by an older pip version that did not
2020
# record origin.json.

src/pip/_internal/operations/prepare.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,12 +571,15 @@ def _prepare_linked_requirement(
571571
# Make sure we have a hash in download_info. If we got it as part of the
572572
# URL, it will have been verified and we can rely on it. Otherwise we
573573
# compute it from the downloaded file.
574+
# FIXME: https://github.com/pypa/pip/issues/11943
574575
if (
575576
isinstance(req.download_info.info, ArchiveInfo)
576-
and not req.download_info.info.hash
577+
and not req.download_info.info.hashes
577578
and local_file
578579
):
579580
hash = hash_file(local_file.path)[0].hexdigest()
581+
# We populate info.hash for backward compatibility.
582+
# This will automatically populate info.hashes.
580583
req.download_info.info.hash = f"sha256={hash}"
581584

582585
# For use in later processing,

src/pip/_internal/resolution/legacy/resolver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def _populate_link(self, req: InstallRequirement) -> None:
436436
req.download_info = cache_entry.origin
437437
else:
438438
# Legacy cache entry that does not have origin.json.
439-
# download_info may miss the archive_info.hash field.
439+
# download_info may miss the archive_info.hashes field.
440440
req.download_info = direct_url_from_link(
441441
req.link, link_is_in_wheel_cache=cache_entry.persistent
442442
)

src/pip/_internal/resolution/resolvelib/candidates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def __init__(
280280
ireq.download_info = cache_entry.origin
281281
else:
282282
# Legacy cache entry that does not have origin.json.
283-
# download_info may miss the archive_info.hash field.
283+
# download_info may miss the archive_info.hashes field.
284284
ireq.download_info = direct_url_from_link(
285285
source_link, link_is_in_wheel_cache=cache_entry.persistent
286286
)

0 commit comments

Comments
 (0)