This commit is contained in:
恍兮惚兮 2024-10-18 20:49:34 +08:00
parent 53b7155b9b
commit ce8395f6a4

View File

@ -241,17 +241,14 @@ for f in collect:
ff.write(bs) ff.write(bs)
target = os.path.basename(targetdir) target = os.path.basename(targetdir)
if os.path.exists(rf"build\{target}.zip"): os.chdir(os.path.dirname(targetdir))
os.remove(rf"build\{target}.zip") if os.path.exists(rf"{target}.zip"):
if os.path.exists(rf"build\{target}.7z"): os.remove(rf"{target}.zip")
os.remove(rf"build\{target}.7z") if os.path.exists(rf"{target}.7z"):
os.system( os.remove(rf"{target}.7z")
rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 build\{target}.zip {targetdir}' os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target}.zip {target}')
)
if 0: if 0:
os.system( os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA2 -mx9 {target}.7z {target}')
rf'"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA2 -mx9 build\{target}.7z {targetdir}'
)
with open(r"C:\Program Files\7-Zip\7z.sfx", "rb") as ff: with open(r"C:\Program Files\7-Zip\7z.sfx", "rb") as ff:
sfx = ff.read() sfx = ff.read()
@ -261,10 +258,10 @@ if 0:
;!@InstallEnd@! ;!@InstallEnd@!
""" """
with open(rf"build\{target}.7z", "rb") as ff: with open(rf"{target}.7z", "rb") as ff:
data = ff.read() data = ff.read()
with open(rf"build\{target}.exe", "wb") as ff: with open(rf"{target}.exe", "wb") as ff:
ff.write(sfx) ff.write(sfx)
ff.write(config.encode("utf8")) ff.write(config.encode("utf8"))
ff.write(data) ff.write(data)