Skip to content

Commit cf6b53d

Browse files
authored
Update nuitka_build.py
1 parent 18fbf16 commit cf6b53d

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

package/nuitka_build.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def main():
3737

3838
# 基础路径设置
3939
base_dir = Path(__file__).parent.parent # 项目根目录
40+
upx_dir = base_dir / './upx/' # UPX目录
4041

4142
success_count = 0
4243
task_error_list = []
@@ -105,8 +106,19 @@ def main():
105106
cmd.extend(['--windows-icon-from-ico=icon.ico', str(icon_path)])
106107
else:
107108
print(f"警告: 图标文件不存在 {icon_path}")
108-
109-
109+
110+
if arrch == "ARM64":
111+
print("UPX不支持当前架构")
112+
else:
113+
if use_upx:
114+
if upx_dir.exists():
115+
cmd.addpend('--plugin-enable=upx')
116+
cmd.extend(['--upx-binary', str(upx_dir)])
117+
print(f"使用UPX压缩: {upx_dir}")
118+
else:
119+
print(f"警告: UPX目录不存在 {upx_dir}")
120+
else:
121+
print("不使用UPX压缩")
110122
# 添加主Python文件
111123
cmd.append(str(python_file))
112124

0 commit comments

Comments
 (0)