mirror of https://github.com/zulip/zulip.git
Enable running tools/run-mypy on a subdirectory.
Previously tools/run-mypy could not run on a subdirectory properly because run-mypy assumed exclude files to be in that subdirectory.
This commit is contained in:
parent
bd63caed96
commit
b210727e5c
|
@ -10,7 +10,7 @@ import argparse
|
|||
import subprocess
|
||||
import six
|
||||
|
||||
exclude="""
|
||||
exclude = """
|
||||
api/integrations/
|
||||
bots/jabber_mirror_backend.py
|
||||
bots/zephyr_mirror_backend.py
|
||||
|
@ -36,6 +36,9 @@ args = parser.parse_args()
|
|||
if args.all:
|
||||
exclude = []
|
||||
|
||||
# find all non-excluded files in current directory
|
||||
BASE_DIR = dirname(dirname(abspath(__file__)))
|
||||
exclude = [os.path.join(BASE_DIR, fpath) for fpath in exclude]
|
||||
python_files = lister.list_files(targets=args.targets, ftypes=['py'], use_shebang=False,
|
||||
modified_only=args.modified, exclude=exclude)
|
||||
|
||||
|
@ -48,6 +51,7 @@ if six.PY2 and os.path.exists(MYPY_VENV_PATH):
|
|||
else:
|
||||
mypy_command = "mypy"
|
||||
|
||||
# run mypy
|
||||
if python_files:
|
||||
rc = subprocess.call([mypy_command, "--fast-parser", "--silent-imports", "--py2", "--check-untyped-defs"] + python_files)
|
||||
sys.exit(rc)
|
||||
|
|
Loading…
Reference in New Issue