Skip to content

Commit e15c050

Browse files
committed
Reformat builder
1 parent ba26222 commit e15c050

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

builder.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def checkTools():
7474
def getPackageLinks():
7575
compressedReqs = ["pyopengl", "pysdl2", "pysidesix-frameless-window"]
7676
extensionReqs = ["pyopengl-accelerate", "pysdl2-dll", "pillow", "pyglm",
77-
"pyside6", "shiboken6", "pyside6-essentials", "pywin32"]
77+
"pyside6", "shiboken6", "pyside6-essentials", "pywin32"]
7878

7979
if parse(VERSION) < parse("3.9"):
8080
compressedReqs.append("importlib-metadata")
@@ -150,8 +150,7 @@ def addPackage(zf, name, path, orig, distInfo=True):
150150
paths.extend(glob.glob("*.dist-info\\**\\*", recursive=True))
151151
for file in paths:
152152
if file.endswith(".py"):
153-
py_compile.compile(file, file + "c", file,
154-
doraise=True)
153+
py_compile.compile(file, file + "c", file, doraise=True)
155154
zf.write(file + "c")
156155
elif not file.endswith(".pyc"):
157156
zf.write(file)
@@ -168,29 +167,29 @@ def getEmbedPackage():
168167
def getPyUnity():
169168
# Do not cache
170169
url = "https://github.com/pyunity/pyunity/archive/refs/heads/develop.zip"
171-
print("GET", url, "-> pyunity.zip", flush=True)
172-
urllib.request.urlretrieve(url, "pyunity.zip")
173-
with zipfile.ZipFile("pyunity.zip") as zf:
174-
print("EXTRACT pyunity.zip", flush=True)
170+
print("GET", url, "-> pyunity-develop.zip", flush=True)
171+
urllib.request.urlretrieve(url, "pyunity-develop.zip")
172+
with zipfile.ZipFile("pyunity-develop.zip") as zf:
173+
print("EXTRACT pyunity-develop.zip", flush=True)
175174
zf.extractall()
176175

177176
def buildSrcPackage(name, directory, outDir):
178177
print("BUILD", name, flush=True)
179178
with open(os.path.join(originalFolder, "build.log"), "a+") as log:
180-
subprocess.call([sys.executable, "-m", "build", directory],
181-
stdout=log, stderr=sys.stderr,
182-
env={**os.environ, "cython": "0"})
179+
subprocess.check_call([sys.executable, "-m", "build", directory],
180+
stdout=log, stderr=sys.stderr,
181+
env={**os.environ, "cython": "0"})
183182
shutil.move(glob.glob(directory + "/dist/*.whl")[0], name + ".whl")
184183

185184
with zipfile.ZipFile(name + ".whl") as zf:
186-
print("EXTRACT", name + ".whl", flush=True)
185+
print("EXTRACT", name + ".whl", flush=True)
187186
zf.extractall(outDir)
188187

189188
def getBinaryPackage(name, url):
190189
if url.endswith(".tar.gz"):
191190
download(url, "..\\" + name + ".tar.gz")
192-
subprocess.call([sys.executable, "-m", "pip", "wheel",
193-
"--no-deps", "..\\" + name + ".tar.gz"])
191+
subprocess.check_call([sys.executable, "-m", "pip", "wheel",
192+
"--no-deps", "..\\" + name + ".tar.gz"])
194193
shutil.move(glob.glob("*.whl")[0], "..\\" + name + ".whl")
195194
else:
196195
download(url, "..\\" + name + ".whl")
@@ -267,16 +266,16 @@ def copyExeInfoFiles():
267266

268267
def compileMsvc():
269268
print("COMPILE icons.o", flush=True)
270-
subprocess.call([
269+
subprocess.check_call([
271270
"rc.exe", "/fo..\\icons.res", "..\\icons.rc"
272271
], stdout=sys.stdout, stderr=sys.stderr)
273272
print("COMPILE version.o", flush=True)
274-
subprocess.call([
273+
subprocess.check_call([
275274
"rc.exe", "/fo..\\version.res", "..\\version.rc"
276275
], stdout=sys.stdout, stderr=sys.stderr)
277276

278277
print("COMPILE pyunity-editor.exe", flush=True)
279-
subprocess.call([
278+
subprocess.check_call([
280279
"cl.exe", "/nologo", "/O2", "/Wall",
281280
"/Tc..\\pyunity-editor.c", "/Fo..\\pyunity-editor.obj",
282281
f"/I{sys.base_prefix}\\include", "/DNOCONSOLE",
@@ -288,33 +287,33 @@ def compileMsvc():
288287

289288
def compileMinGW():
290289
print("COMPILE icons.o", flush=True)
291-
subprocess.call([
290+
subprocess.check_call([
292291
"windres.exe", "-O", "coff",
293292
"..\\icons.rc", "..\\icons.o"
294293
], stdout=sys.stdout, stderr=sys.stderr)
295294
print("COMPILE version.o", flush=True)
296-
subprocess.call([
295+
subprocess.check_call([
297296
"windres.exe", "-O", "coff",
298297
"..\\version.rc", "..\\version.o"
299298
], stdout=sys.stdout, stderr=sys.stderr)
300299

301300
print("COMPILE pyunity-editor.exe", flush=True)
302-
subprocess.call([
301+
subprocess.check_call([
303302
"gcc.exe", "-O2", "-Wall", "-mwindows", "-DNOCONSOLE",
304303
"-o", "pyunity-editor.exe", "..\\pyunity-editor.c", "..\\icons.o", "..\\version.o",
305304
"-L.", f"-l{zipName}", f"-I{sys.base_prefix}\\include",
306305
], stdout=sys.stdout, stderr=sys.stderr)
307306

308307
def archiveFolder():
309308
print(f"ZIP pyunity-editor.zip", flush=True)
310-
subprocess.call([
309+
subprocess.check_call([
311310
"7z.exe", "a", "-mx=9",
312311
f"pyunity-editor.zip", mainFolder
313312
], stdout=sys.stdout, stderr=sys.stderr)
314313
shutil.copy(f"pyunity-editor.zip", originalFolder)
315314

316315
print(f"7Z pyunity-editor.7z", flush=True)
317-
subprocess.call([
316+
subprocess.check_call([
318317
"7z.exe", "a", "-mx=9",
319318
f"pyunity-editor.7z", mainFolder
320319
], stdout=sys.stdout, stderr=sys.stderr)

0 commit comments

Comments
 (0)