LunaTranslator/.github/scripts/packlunahook.py

40 lines
1.1 KiB
Python
Raw Normal View History

2024-11-06 06:46:35 +08:00
import os, shutil, sys
2024-11-08 17:07:24 +08:00
rootDir = os.path.dirname(__file__)
if not rootDir:
rootDir = os.path.abspath(".")
rootDir=os.path.abspath(os.path.join(rootDir,'../../cpp/LunaHook'))
2024-11-06 06:46:35 +08:00
2024-11-08 17:07:24 +08:00
os.chdir(rootDir)
2024-11-09 12:24:31 +08:00
os.chdir('./builds')
for f in os.listdir("."):
if os.path.isdir("./" + f) == False:
2024-11-06 06:46:35 +08:00
continue
2024-11-09 12:24:31 +08:00
for dirname, _, fs in os.walk("./" + f):
2024-11-06 06:46:35 +08:00
if (
dirname.endswith("translations")
or dirname.endswith("translations")
or dirname.endswith("imageformats")
or dirname.endswith("iconengines")
or dirname.endswith("bearer")
):
shutil.rmtree(dirname)
continue
for ff in fs:
path = os.path.join(dirname, ff)
if ff in [
"Qt5Svg.dll",
"libEGL.dll",
"libGLESv2.dll",
"opengl32sw.dll",
"D3Dcompiler_47.dll",
]:
os.remove(path)
2024-11-09 12:24:31 +08:00
targetdir = "./" + f
target = "./" + f + ".zip"
2024-11-06 06:46:35 +08:00
os.system(
rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target} {targetdir}'
)