-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.py
32 lines (28 loc) · 1.27 KB
/
init.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
import os
import subprocess
import yaml
# 确保Imagine System路径中所有的中间目录都存在
thirdparty_dir_path = 'thirdparty/'
os.makedirs(os.path.dirname(thirdparty_dir_path), exist_ok = True)
system_dir_path = os.path.join(thirdparty_dir_path, 'Imagine_System')
tool_dir_path = os.path.join(thirdparty_dir_path, 'Imagine_Tool')
# 判断Imagine System目录是否存在
if os.path.isdir(system_dir_path):
# Imagine System存在直接退出
print("[MAKE INIT]: Imagine_System exists.")
else:
#Imagine System不存在创建
print("[MAKE INIT]: Imagine_System NOT exists, starting create...")
submodule_command = ["git", "submodule", "add", "-f", "https://github.com/ImagineJHY/Imagine_System.git"]
process = subprocess.Popen(submodule_command, cwd = thirdparty_dir_path)
process.wait()
# 判断Imagine Tool目录是否存在
if os.path.isdir(tool_dir_path):
# Imagine Tool存在直接退出
print("[MAKE INIT]: Imagine_Tool exists.")
else:
#Imagine System不存在创建
print("[MAKE INIT]: Imagine_Tool NOT exists, starting create...")
submodule_command = ["git", "submodule", "add", "-f", "https://github.com/ImagineJHY/Imagine_Tool.git"]
process = subprocess.Popen(submodule_command, cwd = thirdparty_dir_path)
process.wait()