Skip to content

Commit 70f1407

Browse files
committed
Update dobuild.py
1 parent 9179544 commit 70f1407

File tree

1 file changed

+34
-14
lines changed

1 file changed

+34
-14
lines changed

scripts/dobuild.py

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,31 @@
2525
pyPath = f"{pyDir}/python.exe"
2626
Qtinstallpath = f"D:/a/PyElaWidgetTools/Qt/{qtversion}/{qtarchdir}"
2727
qmake = f"{Qtinstallpath}/bin/qmake.exe"
28+
sipbuild = f"{pyDir}/Scripts/sip-build"
2829
elif sys.platform == "linux":
2930
pyPathEx = f"/opt/hostedtoolcache/Python/3.12.10/x64/bin/python"
3031
pyDir = f"/opt/hostedtoolcache/Python/{pythonversion}/{arch}/bin"
3132
pyPath = f"{pyDir}/python"
3233
Qtinstallpath = f"/home/runner/work/PyElaWidgetTools/Qt/{qtversion}/{qtarchdir}"
3334
qmake = f"{Qtinstallpath}/bin/qmake"
35+
sipbuild = f"{pyDir}/sip-build"
3436

3537

3638
subprocess.run(f"{pyPath} -m pip install --upgrade pip", shell=True)
3739
if binding.lower().startswith("pyqt"):
3840
if qtversion.startswith("6"):
39-
subprocess.run(f"{pyPath} -m pip install pyqt6==6.6 PyQt-builder sip", shell=True)
41+
subprocess.run(
42+
f"{pyPath} -m pip install pyqt6==6.6 PyQt-builder sip", shell=True
43+
)
4044
else:
4145
subprocess.run(
42-
f"{pyPath} -m pip install pyqt5==5.15.9 PyQt-builder==1.15 sip==6.7", shell=True
46+
f"{pyPath} -m pip install pyqt5==5.15.9 PyQt-builder==1.15 sip==6.7",
47+
shell=True,
4348
)
4449
elif binding.lower().startswith("pyside"):
4550
subprocess.run(
46-
f"{pyPath} -m pip install pyside6=={qtversion} shiboken6=={qtversion} shiboken6_generator=={qtversion}", shell=True
51+
f"{pyPath} -m pip install pyside6=={qtversion} shiboken6=={qtversion} shiboken6_generator=={qtversion}",
52+
shell=True,
4753
)
4854

4955

@@ -76,20 +82,26 @@ def __parsefile(fn, cb):
7682
else:
7783
flags = ""
7884
subprocess.run(
79-
f"cmake -DELAWIDGETTOOLS_BUILD_STATIC_LIB=ON ../ElaWidgetTools/CMakeLists.txt {flags}", shell=True
85+
f"cmake -DELAWIDGETTOOLS_BUILD_STATIC_LIB=ON ../ElaWidgetTools/CMakeLists.txt {flags}",
86+
shell=True,
8087
)
8188
subprocess.run(
82-
f"cmake --build ./ --config Release --target ALL_BUILD -j {os.cpu_count()}", shell=True
89+
f"cmake --build ./ --config Release --target ALL_BUILD -j {os.cpu_count()}",
90+
shell=True,
8391
)
8492
if binding.lower().startswith("pyqt"):
8593
os.chdir("pyqt")
8694
os.mkdir("sip")
8795
subprocess.run(f"python gen_Def.sip.py", shell=True)
88-
subprocess.run(f'python gen_widgets.py {int(qtversion.startswith("5"))}', shell=True)
89-
subprocess.run(f'python gen_pyi_from_sip.py {int(qtversion.startswith("5"))}', shell=True)
96+
subprocess.run(
97+
f'python gen_widgets.py {int(qtversion.startswith("5"))}', shell=True
98+
)
99+
subprocess.run(
100+
f'python gen_pyi_from_sip.py {int(qtversion.startswith("5"))}', shell=True
101+
)
90102
subprocess.run(f"{pyPath} sip_code_fix.py", shell=True)
91103

92-
subprocess.run(rf"{pyDir}/Scripts/sip-build --verbose --qmake {qmake}", shell=True)
104+
subprocess.run(f"{sipbuild} --verbose --qmake {qmake}", shell=True)
93105
# for _dir, _, _fs in os.walk(r"."):
94106
# for _f in _fs:
95107
# print(_dir, _f)
@@ -105,8 +117,12 @@ def __parsefile(fn, cb):
105117
os.chdir("pyqt")
106118
os.mkdir("sip")
107119
subprocess.run(f"python gen_Def.sip.py", shell=True)
108-
subprocess.run(f'python gen_widgets.py {int(qtversion.startswith("5"))}', shell=True)
109-
subprocess.run(f'python gen_pyi_from_sip.py {int(qtversion.startswith("5"))}', shell=True)
120+
subprocess.run(
121+
f'python gen_widgets.py {int(qtversion.startswith("5"))}', shell=True
122+
)
123+
subprocess.run(
124+
f'python gen_pyi_from_sip.py {int(qtversion.startswith("5"))}', shell=True
125+
)
110126
__parsefile(
111127
"ElaWidgetTools.pyi",
112128
lambda c: c.replace("PyQt6", "PySide6").replace("pyqtSignal", "Signal"),
@@ -116,14 +132,17 @@ def __parsefile(fn, cb):
116132
os.chdir("pyside6")
117133

118134
subprocess.run(
119-
f'python gen_xml.py {os.path.abspath("../../ElaWidgetTools/ElaWidgetTools").replace("\\", "/")} {Qtinstallpath} {pyDir}', shell=True
135+
f'python gen_xml.py {os.path.abspath("../../ElaWidgetTools/ElaWidgetTools").replace("\\", "/")} {Qtinstallpath} {pyDir}',
136+
shell=True,
120137
)
121138

122139
subprocess.run(
123-
f'cmake -DMY_QT_INSTALL={Qtinstallpath} -DMY_PYTHON_INSTALL_PATH={pyDir} -DELA_LIB_PATH={os.path.abspath("../ElaWidgetTools/Release/ElaWidgetTools.lib").replace("\\", "/")} -DELA_INCLUDE_PATH={os.path.abspath("../../ElaWidgetTools/ElaWidgetTools").replace("\\", "/")} ./CMakeLists.txt {flags}', shell=True
140+
f'cmake -DMY_QT_INSTALL={Qtinstallpath} -DMY_PYTHON_INSTALL_PATH={pyDir} -DELA_LIB_PATH={os.path.abspath("../ElaWidgetTools/Release/ElaWidgetTools.lib").replace("\\", "/")} -DELA_INCLUDE_PATH={os.path.abspath("../../ElaWidgetTools/ElaWidgetTools").replace("\\", "/")} ./CMakeLists.txt {flags}',
141+
shell=True,
124142
)
125143
subprocess.run(
126-
f"cmake --build ./ --config Release --target ALL_BUILD -j {os.cpu_count()}", shell=True
144+
f"cmake --build ./ --config Release --target ALL_BUILD -j {os.cpu_count()}",
145+
shell=True,
127146
)
128147

129148
os.chdir("..")
@@ -149,7 +168,8 @@ def __parsefile(fn, cb):
149168
if binding.lower().startswith("pyside"):
150169
req = f"PySide6=={qtversion}"
151170
subprocess.run(
152-
f"{pyPathEx} setup.py bdist_wheel {req} {('64','32')[arch == 'x86']} {binding}", shell=True
171+
f"{pyPathEx} setup.py bdist_wheel {req} {('64','32')[arch == 'x86']} {binding}",
172+
shell=True,
153173
)
154174
os.chdir("..")
155175

0 commit comments

Comments
 (0)