-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.py
executable file
·44 lines (29 loc) · 1.01 KB
/
project.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
#!/usr/bin/env python3
import os, sys
def get_base_dir(curr_work_dir):
curr_dir = curr_work_dir
while True:
try:
ver_file_path = os.path.join(curr_dir, "VERSION")
with open(ver_file_path) as f:
lines = f.readlines()
params = lines[0].split()
if params[0] == "Blend4Web":
return os.path.normpath(curr_dir)
except:
pass
up_dir = os.path.normpath(os.path.join(curr_dir, ".."))
if up_dir == curr_dir:
return None
else:
curr_dir = up_dir
if __name__ == "__main__":
curr_work_dir = os.getcwd()
base_dir = get_base_dir(curr_work_dir)
if not base_dir:
print("Blend4Web SDK not found, project management is not available")
print("it's possible that you run this script outside SDK or SDK is broken")
exit(1)
sys.path.append(os.path.join(base_dir, "scripts", "lib"))
import project_cli
project_cli.run(sys.argv, base_dir)