From 892c8ebe652938c196eeb635143fa5617126ef06 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Sun, 20 Oct 2019 11:55:32 +0200 Subject: run_project_tests: Added print_tool_versions() --- run_project_tests.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/run_project_tests.py b/run_project_tests.py index 4bfab0c0..ca0779c 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -867,6 +867,38 @@ def detect_system_compiler(): raise RuntimeError("Could not find C compiler.") print() +def print_tool_versions(): + tools = [ + { + 'tool': 'cmake', + 'args': ['--version'], + 'regex': re.compile(r'^cmake version ([0-9]+(\.[0-9]+)*)$'), + 'match_group': 1, + }, + ] + + def get_version(t: dict) -> str: + exe = shutil.which(t['tool']) + if not exe: + return 'not found' + + args = [t['tool']] + t['args'] + pc, o, e = Popen_safe(args) + if pc.returncode != 0: + return '{} (invalid {} executable)'.format(exe, t['tool']) + for i in o.split('\n'): + i = i.strip('\n\r\t ') + m = t['regex'].match(i) + if m is not None: + return '{} ({})'.format(exe, m.group(t['match_group'])) + + return '{} (unknown)'.format(exe) + + max_width = max([len(x['tool']) for x in tools] + [7]) + for tool in tools: + print('{0:<{2}}: {1}'.format(tool['tool'], get_version(tool), max_width)) + print() + if __name__ == '__main__': parser = argparse.ArgumentParser(description="Run the test suite of Meson.") parser.add_argument('extra_args', nargs='*', @@ -882,6 +914,7 @@ if __name__ == '__main__': setup_commands(options.backend) detect_system_compiler() + print_tool_versions() script_dir = os.path.split(__file__)[0] if script_dir != '': os.chdir(script_dir) -- cgit v1.1