forked from kornia/kornia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify.py
54 lines (41 loc) · 1.46 KB
/
verify.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /usr/bin/env python
"""Script that runs all verification steps.
"""
import argparse
import os
import shutil
from subprocess import run
from subprocess import CalledProcessError
import sys
def main(checks):
try:
print("Verifying with " + str(checks))
if "lint" in checks:
print("Linter (flake8):", flush=True)
run("flake8 kornia test examples", shell=True, check=True)
print("lint checks passed")
if "mypy" in checks:
print("Typechecker (mypy)", flush=True)
run("mypy @mypy_files.txt --ignore-missing-imports", shell=True,
check=True)
print("mypy checks passed")
if "build-docs" in checks:
print("Documentation (build):", flush=True)
run("cd docs; make clean html", shell=True, check=True)
if "check-docs" in checks:
print("Documentation (check):", flush=True)
run("./scripts/check_docs.py", shell=True, check=True)
print("check docs passed")
except CalledProcessError:
# squelch the exception stacktrace
sys.exit(1)
if __name__ == "__main__":
checks = ['lint', 'mypy', 'build-docs', 'check-docs',]
parser = argparse.ArgumentParser()
parser.add_argument('--checks', type=str, required=False, nargs='+', choices=checks)
args = parser.parse_args()
if args.checks:
run_checks = args.checks
else:
run_checks = checks
main(run_checks)