Skip to content

Commit

Permalink
Merge pull request #12120 from pfmoore/fix_11847
Browse files Browse the repository at this point in the history
Record download of completed partial requirements
  • Loading branch information
pfmoore authored Jul 3, 2023
2 parents 4145168 + 8e80a3a commit 4cc183e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/11847.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent downloading files twice when PEP 658 metadata is present
13 changes: 13 additions & 0 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,19 @@ def _complete_partial_requirements(
logger.debug("Downloading link %s to %s", link, filepath)
req = links_to_fully_download[link]
req.local_file_path = filepath
# TODO: This needs fixing for sdists
# This is an emergency fix for #11847, which reports that
# distributions get downloaded twice when metadata is loaded
# from a PEP 658 standalone metadata file. Setting _downloaded
# fixes this for wheels, but breaks the sdist case (tests
# test_download_metadata). As PyPI is currently only serving
# metadata for wheels, this is not an immediate issue.
# Fixing the problem properly looks like it will require a
# complete refactoring of the `prepare_linked_requirements_more`
# logic, and I haven't a clue where to start on that, so for now
# I have fixed the issue *just* for wheels.
if req.is_wheel:
self._downloaded[req.link.url] = filepath

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

0 comments on commit 4cc183e

Please sign in to comment.