-
Notifications
You must be signed in to change notification settings - Fork 164
/
automate.py
executable file
·108 lines (88 loc) · 3.07 KB
/
automate.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python
import sys
sys.path.append('../../scripts')
import base
import os
import subprocess
import deps
def get_branch_name(directory):
cur_dir = os.getcwd()
os.chdir(directory)
# detect build_tools branch
#command = "git branch --show-current"
command = "git symbolic-ref --short -q HEAD"
current_branch = base.run_command(command)['stdout']
os.chdir(cur_dir)
return current_branch
def install_qt():
# qt
if not base.is_file("./qt_source_5.9.9.tar.xz"):
base.download("https://download.qt.io/new_archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz", "./qt_source_5.9.9.tar.xz")
if not base.is_dir("./qt-everywhere-opensource-src-5.9.9"):
base.cmd("tar", ["-xf", "./qt_source_5.9.9.tar.xz"])
qt_params = ["-opensource",
"-confirm-license",
"-release",
"-shared",
"-accessibility",
"-prefix",
"./../qt_build/Qt-5.9.9/gcc_64",
"-qt-zlib",
"-qt-libpng",
"-qt-libjpeg",
"-qt-xcb",
"-qt-pcre",
"-no-sql-sqlite",
"-no-qml-debug",
"-gstreamer", "1.0",
"-nomake", "examples",
"-nomake", "tests",
"-skip", "qtenginio",
"-skip", "qtlocation",
"-skip", "qtserialport",
"-skip", "qtsensors",
"-skip", "qtxmlpatterns",
"-skip", "qt3d",
"-skip", "qtwebview",
"-skip", "qtwebengine"]
base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "./configure", qt_params)
base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make", ["-j", "4"])
base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make", ["install"])
return
if not base.is_file("./node_js_setup_14.x"):
print("install dependencies...")
deps.install_deps()
if not base.is_dir("./qt_build"):
print("install qt...")
install_qt()
branch = get_branch_name("../..")
array_args = sys.argv[1:]
array_modules = []
params = []
config = {}
for arg in array_args:
if (0 == arg.find("--")):
indexEq = arg.find("=")
if (-1 != indexEq):
config[arg[2:indexEq]] = arg[indexEq + 1:]
params.append(arg[:indexEq])
params.append(arg[indexEq + 1:])
else:
array_modules.append(arg)
if ("branch" in config):
branch = config["branch"]
print("---------------------------------------------")
print("build branch: " + branch)
print("---------------------------------------------")
modules = " ".join(array_modules)
if "" == modules:
modules = "desktop builder server"
print("---------------------------------------------")
print("build modules: " + modules)
print("---------------------------------------------")
build_tools_params = ["--branch", branch,
"--module", modules,
"--update", "1",
"--qt-dir", os.getcwd() + "/qt_build/Qt-5.9.9"] + params
base.cmd_in_dir("../..", "./configure.py", build_tools_params)
base.cmd_in_dir("../..", "./make.py")