Output useful configuration information to LOG and TRACE
(manager: BuildManager, sources: list[BuildSource])
| 4013 | |
| 4014 | |
| 4015 | def log_configuration(manager: BuildManager, sources: list[BuildSource]) -> None: |
| 4016 | """Output useful configuration information to LOG and TRACE""" |
| 4017 | |
| 4018 | if not manager.logging_enabled: |
| 4019 | return |
| 4020 | |
| 4021 | config_file = manager.options.config_file |
| 4022 | if config_file: |
| 4023 | config_file = os.path.abspath(config_file) |
| 4024 | |
| 4025 | manager.log() |
| 4026 | configuration_vars = [ |
| 4027 | ("Mypy Version", __version__), |
| 4028 | ("Config File", (config_file or "Default")), |
| 4029 | ("Configured Executable", manager.options.python_executable or "None"), |
| 4030 | ("Current Executable", sys.executable), |
| 4031 | ("Cache Dir", manager.options.cache_dir), |
| 4032 | ("Compiled", str(not __file__.endswith(".py"))), |
| 4033 | ("Exclude", manager.options.exclude), |
| 4034 | ] |
| 4035 | |
| 4036 | for conf_name, conf_value in configuration_vars: |
| 4037 | manager.log(f"{conf_name + ':':24}{conf_value}") |
| 4038 | |
| 4039 | for source in sources: |
| 4040 | manager.log(f"{'Found source:':24}{source}") |
| 4041 | |
| 4042 | # Complete list of searched paths can get very long, put them under TRACE |
| 4043 | for path_type, paths in manager.search_paths.asdict().items(): |
| 4044 | if not paths: |
| 4045 | manager.trace(f"No {path_type}") |
| 4046 | continue |
| 4047 | |
| 4048 | manager.trace(f"{path_type}:") |
| 4049 | |
| 4050 | for pth in paths: |
| 4051 | manager.trace(f" {pth}") |
| 4052 | |
| 4053 | |
| 4054 | # The driver |