From cf64e062bb6f8d95c73a6b292629a7776ff31864 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 26 Nov 2023 02:17:50 -0500 Subject: [PATCH] run_mypy: avoid type-checking tools against every possible python version --- run_mypy.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/run_mypy.py b/run_mypy.py index 16ff318e8..25dc1d568 100755 --- a/run_mypy.py +++ b/run_mypy.py @@ -69,7 +69,8 @@ modules = [ 'mesonbuild/mtest.py', 'mesonbuild/optinterpreter.py', 'mesonbuild/programs.py', - +] +additional = [ 'run_mypy.py', 'run_project_tests.py', 'run_single_test.py', @@ -115,23 +116,29 @@ def main() -> int: print('\x1bc', end='', flush=True) to_check = [] # type: T.List[str] + additional_to_check = [] # type: T.List[str] if opts.files: for f in opts.files: if f in modules: to_check.append(f) elif any(f.startswith(i) for i in modules): to_check.append(f) + elif f in additional: + additional_to_check.append(f) + elif any(f.startswith(i) for i in additional): + additional_to_check.append(f) else: if not opts.quiet: print(f'skipping {f!r} because it is not yet typed') else: to_check.extend(modules) + additional_to_check.extend(additional) if to_check: command = [opts.mypy] if opts.mypy else [sys.executable, '-m', 'mypy'] if not opts.quiet: print('Running mypy (this can take some time) ...') - retcode = subprocess.run(command + args + to_check, cwd=root).returncode + retcode = subprocess.run(command + args + to_check + additional_to_check, cwd=root).returncode if opts.allver and retcode == 0: for minor in range(7, sys.version_info[1]): if not opts.quiet: