-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-system-script.py
More file actions
74 lines (60 loc) · 1.63 KB
/
build-system-script.py
File metadata and controls
74 lines (60 loc) · 1.63 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import sys
import subprocess
from typing import List
def call_all(calls: List[str]):
for call in calls:
if subprocess.call(call.split()) != 0:
raise RuntimeError(f"Call '{call}' failed")
def install_dependencies():
calls = [
"python3 -m pip install --upgrade pip",
"python3 -m pip install -r requirements.txt"
]
call_all(calls)
@NotImplementedError
def run_tests():
pass
# calls = [
# "python3 -m unittest tests/unit_tests.py",
# "python3 -m unittest tests/integration_tests.py"
# ]
# call_all(calls)
@NotImplementedError
def check_coverage():
pass
# calls = [
# "python3 -m coverage run -m unittest tests/unit_tests.py",
# "python3 -m coverage report -m"
# ]
# call_all(calls)
def run_pylint():
calls = [
"python3 -m pylint src"
]
call_all(calls)
def run_type_checking():
calls = [
"python3 -m mypy src"
]
call_all(calls)
if __name__ == "__main__":
if len(sys.argv) != 2:
raise RuntimeError(f"Wrong number of arguments. Expected 2, found {len(sys.argv)}:\n"
f"{sys.argv}")
command = sys.argv[1]
if command == "install-depends":
install_dependencies()
elif command == "type-check":
run_type_checking()
# TODO
# elif command == "test":
# run_tests()
# elif command == "check-coverage":
# check_coverage()
elif command == "pylint":
run_pylint()
elif command == "all-checks":
run_type_checking()
run_pylint()
else:
raise RuntimeError(f"Wrong command '{command}'")