Skip to content

pip download does not conclude downloaded requirements with new resolver #8696

@McSinyx

Description

@McSinyx

For instance,

$ pip download pip
Collecting pip
  Using cached pip-20.2.1-py2.py3-none-any.whl (1.5 MB)
  Saved ./pip-20.2.1-py2.py3-none-any.whl
Successfully downloaded pip
$ rm pip*
$ pip download pip
Collecting pip
  Using cached pip-20.2.1-py2.py3-none-any.whl (1.5 MB)
  Saved ./pip-20.2.1-py2.py3-none-any.whl

This traces back to

downloaded = ' '.join([req.name # type: ignore
for req in requirement_set.requirements.values()
if req.successfully_downloaded])
and that the new resolver never set InstallRequirement.successfully_downloaded. With GH-8685 merged, we can use successfully_downloaded in place of not needs_more_preparation and solve the issue:

def prepare_linked_requirement(self, req, parallel_builds=False):
# type: (InstallRequirement, bool) -> Distribution
"""Prepare a requirement to be obtained from req.link."""
assert req.link
link = req.link
self._log_preparing_link(req)
wheel_dist = self._fetch_metadata(link)
if wheel_dist is not None:
req.needs_more_preparation = True
return wheel_dist
return self._prepare_linked_requirement(req, parallel_builds)
def prepare_linked_requirement_more(self, req, parallel_builds=False):
# type: (InstallRequirement, bool) -> None
"""Prepare a linked requirement more, if needed."""
if not req.needs_more_preparation:
return
self._prepare_linked_requirement(req, parallel_builds)

This happens to be the part I'm working on at the moment, so if it is not urgent, I will submit a patch in around 12 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions