-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder.py
56 lines (50 loc) · 1.53 KB
/
builder.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
from linpgtoolbox.builder import Builder, SmartAutoModuleCombineMode
# 暂时重命名__init__.py文件以防止其干扰mypy typing生成工具
TEMP_INIT_NAME: str = "TEMP__init__.py"
if os.path.exists("__init__.py"):
os.rename("__init__.py", TEMP_INIT_NAME)
# 额外需要打包的文件
additional_files: tuple[str, ...] = ("README.md", "LICENSE", "CODE_OF_CONDUCT.md")
# 开始编译源代码
Builder.compile(
"linpg",
additional_files=additional_files,
smart_auto_module_combine=SmartAutoModuleCombineMode.FOLDER_ONLY,
update_the_one_in_sitepackages=True,
include_pyinstaller_program=True,
options={
"enable_multiprocessing": True,
"compiler_directives": {"emit_code_comments": False},
"hidden_imports": [
"av",
"PIL.Image",
"PIL.ImageColor",
"PIL.ImageFilter",
"numpy",
"pygame",
"pygame.gfxdraw",
"pyvns",
"tkinter",
"tkinter.messagebox",
],
},
)
# 如果前面__init__.py已被成功重命名,则把其重命名回去
if os.path.exists(TEMP_INIT_NAME):
os.rename(TEMP_INIT_NAME, "__init__.py")
# 提示编译完成
for i in range(2):
print("")
print("--------------------Done!--------------------")
for i in range(2):
print("")
# 打包上传最新的文件
"""
match input("Do you want to package and upload the latest build (Y/n):"):
case "Y":
Builder.build()
Builder.upload()
case "N":
Builder.remove("src")
"""