Skip to content

Commit

Permalink
Present found conflicts when discarding some criterion
Browse files Browse the repository at this point in the history
Fixes gh-9254.
Closes gh-10258.
See #10258 (comment) for inspiration.
  • Loading branch information
astrojuanlu committed Feb 27, 2023
1 parent 61e85bf commit 7c82696
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pip/_internal/resolution/resolvelib/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ def rejecting_candidate(self, criterion: Any, candidate: Candidate) -> None:
message = self._messages_at_reject_count[count]
logger.info("INFO: %s", message.format(package_name=candidate.name))

msg = "Will try a different candidate, due to conflict:"
for req_info in criterion.information:
req, parent = req_info.requirement, req_info.parent
# Inspired by Factory.get_installation_error
msg += "\n "
if parent:
msg += f"{parent.name} {parent.version} depends on "
else:
msg += "The user requested "
msg += req.format_for_error()
logger.debug(msg)


class PipDebuggingReporter(BaseReporter):
"""A reporter that does an info log for every event it sees."""
Expand Down

0 comments on commit 7c82696

Please sign in to comment.