Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c4a6e40

Browse files
jxclilevkivskyi
authored andcommitted
Add startup debug information (#6780)
Implements some ideas from #6544
1 parent 2c6cd83 commit c4a6e40

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

mypy/build.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,12 +2399,39 @@ def skipping_ancestor(manager: BuildManager, id: str, path: str, ancestor_for: '
23992399
severity='note', only_once=True)
24002400

24012401

2402+
def log_configuration(manager: BuildManager) -> None:
2403+
"""Output useful configuration information to LOG and TRACE"""
2404+
2405+
manager.log()
2406+
configuration_vars = (
2407+
("Mypy Version", __version__),
2408+
("Config File", (manager.options.config_file or "Default")),
2409+
("Configured Executable", manager.options.python_executable),
2410+
("Current Executable", sys.executable),
2411+
("Cache Dir", manager.options.cache_dir),
2412+
)
2413+
2414+
for conf_name, conf_value in configuration_vars:
2415+
manager.log("{:24}{}".format(conf_name + ":", conf_value))
2416+
2417+
# Complete list of searched paths can get very long, put them under TRACE
2418+
for path_type, paths in manager.search_paths._asdict().items():
2419+
if not paths:
2420+
manager.trace("No %s" % path_type)
2421+
continue
2422+
2423+
manager.trace("%s:" % path_type)
2424+
2425+
for pth in paths:
2426+
manager.trace(" %s" % pth)
2427+
2428+
24022429
# The driver
24032430

24042431

24052432
def dispatch(sources: List[BuildSource], manager: BuildManager) -> Graph:
2406-
manager.log()
2407-
manager.log("Mypy version %s" % __version__)
2433+
log_configuration(manager)
2434+
24082435
t0 = time.time()
24092436
graph = load_graph(sources, manager)
24102437

0 commit comments

Comments
 (0)