Skip to content

Commit d6e6ed2

Browse files
committed
[2020-resolver] List downloaded distributions before exiting.
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.
1 parent f51bd8f commit d6e6ed2

File tree

4 files changed

+9
-19
lines changed

4 files changed

+9
-19
lines changed

news/8696.bugfix

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
List downloaded distributions before exiting ``pip download``
2+
when using the new resolver to make the behavior the same as
3+
that on the legacy resolver.

src/pip/_internal/commands/download.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,12 @@ def run(self, options, args):
134134
reqs, check_supported_wheels=True
135135
)
136136

137-
downloaded = ' '.join([req.name # type: ignore
138-
for req in requirement_set.requirements.values()
139-
if req.successfully_downloaded])
137+
downloaded = [] # type: List[str]
138+
for req in requirement_set.requirements.values():
139+
if not req.editable and req.satisfied_by is None:
140+
assert req.name is not None
141+
downloaded.append(req.name)
140142
if downloaded:
141-
write_output('Successfully downloaded %s', downloaded)
143+
write_output('Successfully downloaded %s', ' '.join(downloaded))
142144

143145
return SUCCESS

src/pip/_internal/req/req_install.py

-9
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,6 @@ def __init__(
179179
# e.g. dependencies, extras or constraints.
180180
self.user_supplied = user_supplied
181181

182-
# Set by the legacy resolver when the requirement has been downloaded
183-
# TODO: This introduces a strong coupling between the resolver and the
184-
# requirement (the coupling was previously between the resolver
185-
# and the requirement set). This should be refactored to allow
186-
# the requirement to decide for itself when it has been
187-
# successfully downloaded - but that is more tricky to get right,
188-
# se we are making the change in stages.
189-
self.successfully_downloaded = False
190-
191182
self.isolated = isolated
192183
self.build_env = NoOpBuildEnvironment() # type: BuildEnvironment
193184

src/pip/_internal/resolution/legacy/resolver.py

-6
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,6 @@ def add_req(subreq, extras_requested):
444444
for subreq in dist.requires(available_requested):
445445
add_req(subreq, extras_requested=available_requested)
446446

447-
if not req_to_install.editable and not req_to_install.satisfied_by:
448-
# XXX: --no-install leads this to report 'Successfully
449-
# downloaded' for only non-editable reqs, even though we took
450-
# action on them.
451-
req_to_install.successfully_downloaded = True
452-
453447
return more_reqs
454448

455449
def get_installation_order(self, req_set):

0 commit comments

Comments
 (0)