Skip to content

Commit 647ba8d

Browse files
committed
Limit the double download fix to wheels
1 parent cb25bf3 commit 647ba8d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/pip/_internal/operations/prepare.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +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-
self._downloaded[req.link.url] = 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 not 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
475487

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

0 commit comments

Comments
 (0)