-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwrapping.py
38 lines (30 loc) · 1.15 KB
/
wrapping.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
if __name__ == "__main__":
from os import path as PATH
import shutil
from linpgtoolbox.builder import Builder, PackageInstaller, PyInstaller
# 编译游戏本体
if (
not PATH.exists("src")
or input("Do you want to recompile source files (Y/n):") == "Y"
):
Builder.remove("src")
Builder.compile("Source")
# 更新所有第三方库
if input("Do you want to update all third party packages (Y/n):") == "Y":
PackageInstaller.upgrade()
# 删除dist文件夹
Builder.remove("dist")
# 打包main文件
PyInstaller.pack("main.spec")
# 移动素材
_ADDITIONAL_ASSETS: tuple[str, ...] = ("Assets", "Data", "Lang")
for additional_dir in _ADDITIONAL_ASSETS:
shutil.copytree(
PATH.join(".", additional_dir), PATH.join("dist", "main", additional_dir)
)
# 重命名文件
shutil.move(PATH.join("dist", "main"), PATH.join("dist", "GirlsFrontLine-LastWish"))
# 移除移除的缓存文件
folders_need_remove: tuple[str, ...] = ("build", "logs", "__pycache__")
for folder_p in folders_need_remove:
Builder.remove(folder_p)