Skip to content

Commit

Permalink
[2020-resolver] List downloaded distributions before exiting.
Browse files Browse the repository at this point in the history
This unifies the behavior of pip download for both legacy and new
resolvers.  InstallRequirement.successfully_download is no longer needed
for this task and is thus retired.
  • Loading branch information
McSinyx committed Aug 6, 2020
1 parent f51bd8f commit d6e6ed2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
3 changes: 3 additions & 0 deletions news/8696.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
List downloaded distributions before exiting ``pip download``
when using the new resolver to make the behavior the same as
that on the legacy resolver.
10 changes: 6 additions & 4 deletions src/pip/_internal/commands/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,12 @@ def run(self, options, args):
reqs, check_supported_wheels=True
)

downloaded = ' '.join([req.name # type: ignore
for req in requirement_set.requirements.values()
if req.successfully_downloaded])
downloaded = [] # type: List[str]
for req in requirement_set.requirements.values():
if not req.editable and req.satisfied_by is None:
assert req.name is not None
downloaded.append(req.name)
if downloaded:
write_output('Successfully downloaded %s', downloaded)
write_output('Successfully downloaded %s', ' '.join(downloaded))

return SUCCESS
9 changes: 0 additions & 9 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,6 @@ def __init__(
# e.g. dependencies, extras or constraints.
self.user_supplied = user_supplied

# Set by the legacy resolver when the requirement has been downloaded
# TODO: This introduces a strong coupling between the resolver and the
# requirement (the coupling was previously between the resolver
# and the requirement set). This should be refactored to allow
# the requirement to decide for itself when it has been
# successfully downloaded - but that is more tricky to get right,
# se we are making the change in stages.
self.successfully_downloaded = False

self.isolated = isolated
self.build_env = NoOpBuildEnvironment() # type: BuildEnvironment

Expand Down
6 changes: 0 additions & 6 deletions src/pip/_internal/resolution/legacy/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,6 @@ def add_req(subreq, extras_requested):
for subreq in dist.requires(available_requested):
add_req(subreq, extras_requested=available_requested)

if not req_to_install.editable and not req_to_install.satisfied_by:
# XXX: --no-install leads this to report 'Successfully
# downloaded' for only non-editable reqs, even though we took
# action on them.
req_to_install.successfully_downloaded = True

return more_reqs

def get_installation_order(self, req_set):
Expand Down

0 comments on commit d6e6ed2

Please sign in to comment.