diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-03-02 15:46:38 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-03-02 15:52:45 -0500 |
commit | 2d26c272c3225f99c945d2c510c61910c34a9377 (patch) | |
tree | 274f5e9fcf34cc111ff6011ca55ab6c71110f7a0 /run_mypy.py | |
parent | 3946f1eb177c1633dc5637b7d8ef7240a470691d (diff) | |
download | meson-2d26c272c3225f99c945d2c510c61910c34a9377.zip meson-2d26c272c3225f99c945d2c510c61910c34a9377.tar.gz meson-2d26c272c3225f99c945d2c510c61910c34a9377.tar.bz2 |
run_mypy: accept the path to an alternative mypy executable
mypy might be installed with a different python than the one run_mypy.py
is using.
Diffstat (limited to 'run_mypy.py')
-rwxr-xr-x | run_mypy.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/run_mypy.py b/run_mypy.py index 9ad43b8..338968d 100755 --- a/run_mypy.py +++ b/run_mypy.py @@ -96,6 +96,7 @@ def main() -> int: parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('files', nargs='*') + parser.add_argument('--mypy', help='path to mypy executable') parser.add_argument('-q', '--quiet', action='store_true', help='do not print informational messages') parser.add_argument('-p', '--pretty', action='store_true', help='pretty print mypy errors') parser.add_argument('-C', '--clear', action='store_true', help='clear the terminal before running mypy') @@ -121,12 +122,10 @@ def main() -> int: to_check.extend(modules) 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) ...') - p = subprocess.run( - [sys.executable, '-m', 'mypy'] + args + to_check, - cwd=root, - ) + p = subprocess.run(command + args + to_check, cwd=root) return p.returncode else: if not opts.quiet: |