mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Trace common finder info outside resolver
There's no reason for Resolver to trace this information about our PackageFinder, we just need a common one-time function to trace useful information.
This commit is contained in:
parent
ef20309867
commit
f305f66eb2
5 changed files with 24 additions and 6 deletions
|
@ -8,6 +8,7 @@ PackageFinder machinery and all its vendored dependencies, etc.
|
|||
# The following comment should be removed at some point in the future.
|
||||
# mypy: disallow-untyped-defs=False
|
||||
|
||||
import logging
|
||||
import os
|
||||
from functools import partial
|
||||
|
||||
|
@ -41,6 +42,8 @@ if MYPY_CHECK_RUNNING:
|
|||
from pip._internal.req.req_tracker import RequirementTracker
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SessionCommandMixin(CommandContextMixIn):
|
||||
|
||||
|
@ -272,6 +275,18 @@ class RequirementCommand(IndexGroupCommand):
|
|||
'You must give at least one requirement to %(name)s '
|
||||
'(see "pip help %(name)s")' % opts)
|
||||
|
||||
@staticmethod
|
||||
def trace_basic_info(finder):
|
||||
# type: (PackageFinder) -> None
|
||||
"""
|
||||
Trace basic information about the provided objects.
|
||||
"""
|
||||
# Display where finder is looking for packages
|
||||
search_scope = finder.search_scope
|
||||
locations = search_scope.get_formatted_locations()
|
||||
if locations:
|
||||
logger.info(locations)
|
||||
|
||||
def _build_package_finder(
|
||||
self,
|
||||
options, # type: Values
|
||||
|
|
|
@ -139,6 +139,9 @@ class DownloadCommand(RequirementCommand):
|
|||
options=options,
|
||||
py_version_info=options.python_version,
|
||||
)
|
||||
|
||||
self.trace_basic_info(finder)
|
||||
|
||||
resolver.resolve(requirement_set)
|
||||
|
||||
downloaded = ' '.join([
|
||||
|
|
|
@ -373,6 +373,9 @@ class InstallCommand(RequirementCommand):
|
|||
upgrade_strategy=upgrade_strategy,
|
||||
use_pep517=options.use_pep517,
|
||||
)
|
||||
|
||||
self.trace_basic_info(finder)
|
||||
|
||||
resolver.resolve(requirement_set)
|
||||
|
||||
try:
|
||||
|
|
|
@ -185,6 +185,9 @@ class WheelCommand(RequirementCommand):
|
|||
ignore_requires_python=options.ignore_requires_python,
|
||||
use_pep517=options.use_pep517,
|
||||
)
|
||||
|
||||
self.trace_basic_info(finder)
|
||||
|
||||
resolver.resolve(requirement_set)
|
||||
|
||||
# build wheels
|
||||
|
|
|
@ -181,12 +181,6 @@ class Resolver(object):
|
|||
any(req.has_hash_options for req in root_reqs)
|
||||
)
|
||||
|
||||
# Display where finder is looking for packages
|
||||
search_scope = self.finder.search_scope
|
||||
locations = search_scope.get_formatted_locations()
|
||||
if locations:
|
||||
logger.info(locations)
|
||||
|
||||
# Actually prepare the files, and collect any exceptions. Most hash
|
||||
# exceptions cannot be checked ahead of time, because
|
||||
# req.populate_link() needs to be called before we can make decisions
|
||||
|
|
Loading…
Reference in a new issue