Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: log build sources with -v #9672

Merged
merged 1 commit into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 6 additions & 18 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2541,37 +2541,25 @@ def skipping_ancestor(manager: BuildManager, id: str, path: str, ancestor_for: '
severity='note', only_once=True)


def log_configuration(manager: BuildManager) -> None:
def log_configuration(manager: BuildManager, sources: List[BuildSource]) -> None:
"""Output useful configuration information to LOG and TRACE"""

manager.log()
configuration_vars = [
("Mypy Version", __version__),
("Config File", (manager.options.config_file or "Default")),
]

src_pth_str = "Source Path"
src_pths = list(manager.source_set.source_paths.copy())
src_pths.sort()

if len(src_pths) > 1:
src_pth_str += "s"
configuration_vars.append((src_pth_str, " ".join(src_pths)))
elif len(src_pths) == 1:
configuration_vars.append((src_pth_str, src_pths.pop()))
else:
configuration_vars.append((src_pth_str, "None"))

configuration_vars.extend([
("Configured Executable", manager.options.python_executable or "None"),
("Current Executable", sys.executable),
("Cache Dir", manager.options.cache_dir),
("Compiled", str(not __file__.endswith(".py"))),
])
]

for conf_name, conf_value in configuration_vars:
manager.log("{:24}{}".format(conf_name + ":", conf_value))

for source in sources:
manager.log("{:24}{}".format("Found source:", source))

# Complete list of searched paths can get very long, put them under TRACE
for path_type, paths in manager.search_paths._asdict().items():
if not paths:
Expand All @@ -2591,7 +2579,7 @@ def dispatch(sources: List[BuildSource],
manager: BuildManager,
stdout: TextIO,
) -> Graph:
log_configuration(manager)
log_configuration(manager, sources)

t0 = time.time()
graph = load_graph(sources, manager)
Expand Down
2 changes: 1 addition & 1 deletion mypy/modulefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, path: Optional[str], module: Optional[str],
self.base_dir = base_dir # Directory where the package is rooted (e.g. 'xxx/yyy')

def __repr__(self) -> str:
return '<BuildSource path=%r module=%r has_text=%s base_dir=%s>' % (
return 'BuildSource(path=%r, module=%r, has_text=%s, base_dir=%r)' % (
self.path,
self.module,
self.text is not None,
Expand Down