Skip to content

Commit

Permalink
Merge pull request #8861 from pradyunsg/nicer-output-try-1
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg authored Sep 17, 2020
2 parents e61bb61 + 0fc1044 commit 67ab116
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions news/8861.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tweak the output during dependency resolution in the new resolver.
22 changes: 17 additions & 5 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ def __init__(
# Memoized downloaded files, as mapping of url: (path, mime type)
self._downloaded = {} # type: Dict[str, Tuple[str, str]]

# Previous "header" printed for a link-based InstallRequirement
self._previous_requirement_header = ("", "")

@property
def _download_should_save(self):
# type: () -> bool
Expand All @@ -373,12 +376,21 @@ def _download_should_save(self):

def _log_preparing_link(self, req):
# type: (InstallRequirement) -> None
"""Log the way the link prepared."""
if req.link.is_file:
path = req.link.file_path
logger.info('Processing %s', display_path(path))
"""Provide context for the requirement being prepared."""
if req.link.is_file and not req.original_link_is_in_wheel_cache:
message = "Processing %s"
information = str(display_path(req.link.file_path))
else:
logger.info('Collecting %s', req.req or req)
message = "Collecting %s"
information = str(req.req or req)

if (message, information) != self._previous_requirement_header:
self._previous_requirement_header = (message, information)
logger.info(message, information)

if req.original_link_is_in_wheel_cache:
with indent_log():
logger.info("Using cached %s", req.link.filename)

def _get_download_dir(self, link):
# type: (Link) -> Optional[str]
Expand Down

0 comments on commit 67ab116

Please sign in to comment.