Skip to content

Commit

Permalink
Bring back the "from versions:" message
Browse files Browse the repository at this point in the history
In the new resolver the "(from versions ...)" message, shown on
failure to resolve a package, has been removed. This commit brings it
back.
  • Loading branch information
MrMino committed Jan 3, 2021
1 parent 7369ac2 commit 3017504
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/9139.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bring back the "(from versions: ...)" message, that was shown on resolution failures.
9 changes: 8 additions & 1 deletion src/pip/_internal/resolution/resolvelib/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,17 @@ def get_installation_error(self, e):
req_disp = str(req)
else:
req_disp = f'{req} (from {parent.name})'

cands = self._finder.find_all_candidates(req.project_name)
versions = [str(v) for v in sorted(set(c.version for c in cands))]

logger.critical(
"Could not find a version that satisfies the requirement %s",
"Could not find a version that satisfies the requirement %s "
"(from versions: %s)",
req_disp,
', '.join(versions) or 'none',
)

return DistributionNotFound(
f'No matching distribution found for {req}'
)
Expand Down

0 comments on commit 3017504

Please sign in to comment.