Files
nezhacursormac/build_win.py
huangzhenpc 96604f7139
Some checks failed
Remove old artifacts / remove-old-artifacts (push) Has been cancelled
first commit: 初始化项目,添加基本功能和打包脚本
2025-02-17 18:58:01 +08:00

35 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import PyInstaller.__main__
import os
import sys
# 获取当前脚本所在目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 打包参数
params = [
'gui/main_window.py', # 主程序入口
'--name=听泉助手', # 应用名称
'--onefile', # 打包成单个文件
'--windowed', # 不显示控制台窗口
'--clean', # 清理临时文件
'--noconfirm', # 不确认覆盖
f'--distpath={os.path.join(current_dir, "dist")}', # 输出目录
f'--workpath={os.path.join(current_dir, "build")}', # 工作目录
f'--specpath={current_dir}', # spec文件目录
'--add-data=logger.py;.', # 添加额外文件
'--add-data=update_cursor_token.py;.',
'--add-data=cursor_auth_manager.py;.',
'--add-data=reset_machine.py;.',
'--add-data=patch_cursor_get_machine_id.py;.',
'--add-data=exit_cursor.py;.',
'--add-data=go_cursor_help.py;.',
'--add-data=logo.py;.',
'--hidden-import=PyQt5',
'--hidden-import=requests',
'--hidden-import=urllib3',
]
# 执行打包
PyInstaller.__main__.run(params)
print("打包完成可执行文件已生成在dist目录下。")