summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2020-08-05 15:04:07 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2020-08-06 16:52:31 +0700
commit4f210f36089398fccce91c1a5769a8b5e7258cc7 (patch)
tree9d1acbec8d688f8deb43338d6a8d1c2bae2aea92
parentf51bd8fed8ca3c96c87cef22fa2f5a8098e4b4bd (diff)
downloadpip-4f210f36089398fccce91c1a5769a8b5e7258cc7.tar.gz
[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.
-rw-r--r--news/8696.bugfix3
-rw-r--r--src/pip/_internal/commands/download.py10
-rw-r--r--src/pip/_internal/req/req_install.py9
-rw-r--r--src/pip/_internal/resolution/legacy/resolver.py6
4 files changed, 9 insertions, 19 deletions
diff --git a/news/8696.bugfix b/news/8696.bugfix
new file mode 100644
index 000000000..989d2d029
--- /dev/null
+++ b/news/8696.bugfix
@@ -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.
diff --git a/src/pip/_internal/commands/download.py b/src/pip/_internal/commands/download.py
index 46e837126..0861d9e67 100644
--- a/src/pip/_internal/commands/download.py
+++ b/src/pip/_internal/commands/download.py
@@ -134,10 +134,12 @@ class DownloadCommand(RequirementCommand):
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
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
index 816969f8e..907c40249 100644
--- a/src/pip/_internal/req/req_install.py
+++ b/src/pip/_internal/req/req_install.py
@@ -179,15 +179,6 @@ class InstallRequirement(object):
# 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
diff --git a/src/pip/_internal/resolution/legacy/resolver.py b/src/pip/_internal/resolution/legacy/resolver.py
index a743b5696..d2dafa77f 100644
--- a/src/pip/_internal/resolution/legacy/resolver.py
+++ b/src/pip/_internal/resolution/legacy/resolver.py
@@ -444,12 +444,6 @@ class Resolver(BaseResolver):
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):