This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
forked from OpenSimulationInterface/osi-antora-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
70 lines (59 loc) · 1.71 KB
/
build.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
from ast import AsyncFunctionDef
import os,sys,getopt
def main(argv):
parameters="sfr"
parameters_long = ["start","finish", "remote"]
do_start = False
do_finish = False
do_test = False
do_remote = False
try:
opts, args = getopt.getopt(argv,parameters,parameters_long)
except:
print("Optional parameters are: -s, --start, -f, --finish, -r, --remote")
for opt,arg in opts:
if opt in ("-s","--start"):
do_start = True
elif opt in ("-f","--finish"):
do_finish = True
do_clean = True
elif opt in ("-r","--remote"):
do_remote = True
if not (do_start or do_finish):
do_start = do_finish = True
if do_start:
if (do_remote):
run_docker_compose(True)
else:
run_docker_compose()
if do_finish:
open_project_guide()
print("BUILD DONE")
def run_docker_compose(remote_setup=False):
if (remote_setup):
target = "docker-compose"
else:
target = "docker-compose -f docker-compose-local.yml"
print("RUN DOCKER-COMPOSE WITH " + target)
try:
os.chdir("../")
os.system(target+" run antora")
os.chdir("scripts")
except:
try:
os.system(target+" run antora")
except:
pass
def open_project_guide():
print("OPEN INDEX.HTML")
try:
os.chdir("../site")
# print(os.getcwd())
os.system("start chrome {pos}".format(pos = os.getcwd()+"/index.html"))
except:
try:
os.system("start chrome {pos}".format(pos = os.getcwd()+"/index.html"))
except:
pass
if __name__ == "__main__":
main(sys.argv[1:])