forked from gynvael/osdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage.py
executable file
·45 lines (40 loc) · 1.18 KB
/
manage.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
#!/usr/bin/python
from __future__ import print_function
import shutil
import traceback
import sys
import os
from scripts import build, run
def main():
# Add missing directories if needed
for directory in ("tmp", "bin",):
if not os.path.exists(directory):
os.makedirs(directory)
# Parse console arguments
if len(sys.argv) == 2:
os.chdir("tmp/")
if sys.argv[1] == "build":
build()
elif sys.argv[1] == "run":
run()
elif sys.argv[1] == "test":
build()
run()
elif sys.argv[1] == "clean":
os.chdir("..")
shutil.rmtree("tmp")
print("Cleaned ./tmp directory.")
elif sys.argv[1] == "help":
print("Usage:")
print(" build\t- Build project")
print(" run\t- Run project")
print(" test\t- Build and run project")
print(" clean\t- Clean temporary directory\n")
else:
print("Invalid argument: " + sys.argv[1])
sys.exit(1)
else:
print("Missing arguments. Use 'help' to display usage.")
sys.exit(1)
if __name__ == "__main__":
main()