From 85751e1ffc013e11ae84adc7ce0503cd36e2ff64 Mon Sep 17 00:00:00 2001 From: Alexander Bliskovsky Date: Mon, 6 May 2019 11:56:41 -0600 Subject: [PATCH 1/2] Add startup debug information (#6544) --- mypy/build.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/mypy/build.py b/mypy/build.py index ca14ebe75d243..cd12c677ac349 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -2398,12 +2398,38 @@ def skipping_ancestor(manager: BuildManager, id: str, path: str, ancestor_for: ' severity='note', only_once=True) +def log_configuration(manager: BuildManager) -> None: + """Output useful configuration information to LOG and TRACE""" + + manager.log() + manager.log("Mypy version %s" % __version__) + manager.log("Python interpreter located at: %s" % manager.options.python_executable) + + if manager.options.config_file: + manager.log("Using configuration at: %s" % manager.options.config_file) + else: + manager.log("Using default configuration") + + manager.log("Using cache dir: %s" % manager.options.cache_dir) + + # 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: + manager.trace("No %s" % path_type) + continue + + manager.trace("%s:" % path_type) + + for pth in paths: + manager.trace(" %s" % pth) + + # The driver def dispatch(sources: List[BuildSource], manager: BuildManager) -> Graph: - manager.log() - manager.log("Mypy version %s" % __version__) + log_configuration(manager) + t0 = time.time() graph = load_graph(sources, manager) From 937075f533970064e21f4b9668a3c0ccd3fac941 Mon Sep 17 00:00:00 2001 From: Alexander Bliskovsky Date: Mon, 6 May 2019 13:08:49 -0600 Subject: [PATCH 2/2] Configuration formatting changes --- mypy/build.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/mypy/build.py b/mypy/build.py index cd12c677ac349..86adac3090702 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -2402,15 +2402,16 @@ def log_configuration(manager: BuildManager) -> None: """Output useful configuration information to LOG and TRACE""" manager.log() - manager.log("Mypy version %s" % __version__) - manager.log("Python interpreter located at: %s" % manager.options.python_executable) - - if manager.options.config_file: - manager.log("Using configuration at: %s" % manager.options.config_file) - else: - manager.log("Using default configuration") + configuration_vars = ( + ("Mypy Version", __version__), + ("Config File", (manager.options.config_file or "Default")), + ("Configured Executable", manager.options.python_executable), + ("Current Executable", sys.executable), + ("Cache Dir", manager.options.cache_dir), + ) - manager.log("Using cache dir: %s" % manager.options.cache_dir) + for conf_name, conf_value in configuration_vars: + manager.log("{:24}{}".format(conf_name + ":", conf_value)) # Complete list of searched paths can get very long, put them under TRACE for path_type, paths in manager.search_paths._asdict().items():