summaryrefslogtreecommitdiff
path: root/run_mypy.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-03-02 15:46:38 -0500
committerEli Schwartz <eschwartz@archlinux.org>2023-03-02 15:52:45 -0500
commit2d26c272c3225f99c945d2c510c61910c34a9377 (patch)
tree274f5e9fcf34cc111ff6011ca55ab6c71110f7a0 /run_mypy.py
parent3946f1eb177c1633dc5637b7d8ef7240a470691d (diff)
downloadmeson-2d26c272c3225f99c945d2c510c61910c34a9377.tar.gz
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-xrun_mypy.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/run_mypy.py b/run_mypy.py
index 9ad43b880..338968d49 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: