-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject_scripts.py
79 lines (63 loc) · 1.45 KB
/
project_scripts.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import os
import shutil
import subprocess
import sys
def check_mypy():
process = subprocess.run(
"mypy --install-types",
stderr=sys.stderr,
stdout=sys.stdout
)
if process.returncode != 0:
exit(process.returncode)
process = subprocess.run(
"mypy embark",
stderr=sys.stderr,
stdout=sys.stdout
)
if process.returncode != 0:
exit(process.returncode)
def check_imports():
process = subprocess.run(
"lint-imports",
stderr=sys.stderr,
stdout=sys.stdout
)
if process.returncode != 0:
exit(process.returncode)
def check_ruff():
process = subprocess.run(
"ruff check",
stderr=sys.stderr,
stdout=sys.stdout
)
if process.returncode != 0:
exit(process.returncode)
def check_wps():
process = subprocess.run(
"flake8 ./embark",
stderr=sys.stderr,
stdout=sys.stdout
)
if process.returncode != 0:
exit(process.returncode)
def check_all():
check_all_no_wps()
check_wps()
def check_all_no_wps():
check_mypy()
check_imports()
check_ruff()
def clean_build():
if os.path.exists("build"):
shutil.rmtree("build")
if os.path.exists("dist"):
shutil.rmtree("dist")
build()
def build():
process = subprocess.run(
"build.bat",
stderr=sys.stderr,
stdout=sys.stdout
)
exit(process.returncode)