Skip to content

Commit 4cc183e

Browse files
authored
Merge pull request #12120 from pfmoore/fix_11847
Record download of completed partial requirements
2 parents 4145168 + 8e80a3a commit 4cc183e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

news/11847.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Prevent downloading files twice when PEP 658 metadata is present

src/pip/_internal/operations/prepare.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,19 @@ def _complete_partial_requirements(
471471
logger.debug("Downloading link %s to %s", link, filepath)
472472
req = links_to_fully_download[link]
473473
req.local_file_path = filepath
474+
# TODO: This needs fixing for sdists
475+
# This is an emergency fix for #11847, which reports that
476+
# distributions get downloaded twice when metadata is loaded
477+
# from a PEP 658 standalone metadata file. Setting _downloaded
478+
# fixes this for wheels, but breaks the sdist case (tests
479+
# test_download_metadata). As PyPI is currently only serving
480+
# metadata for wheels, this is not an immediate issue.
481+
# Fixing the problem properly looks like it will require a
482+
# complete refactoring of the `prepare_linked_requirements_more`
483+
# logic, and I haven't a clue where to start on that, so for now
484+
# I have fixed the issue *just* for wheels.
485+
if req.is_wheel:
486+
self._downloaded[req.link.url] = filepath
474487

475488
# This step is necessary to ensure all lazy wheels are processed
476489
# successfully by the 'download', 'wheel', and 'install' commands.

0 commit comments

Comments
 (0)