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.
pull/11486/head
Eli Schwartz 2 years ago
parent 3946f1eb17
commit 2d26c272c3
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 7
      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:

Loading…
Cancel
Save