# -*- mode: python ; coding: utf-8 -*- import os import pathlib import sys project_root = pathlib.Path(os.getcwd()).resolve() main_path = project_root / "main.py" build_path = project_root / "build" build_pyinstaller_path = build_path / "pyinstaller" source_code_root = project_root / "src" third_party_root = project_root / "third_party" if source_code_root.as_posix() not in sys.path: sys.path.insert(0, source_code_root.as_posix()) if third_party_root.as_posix() not in sys.path: sys.path.insert(0, third_party_root.as_posix()) # --- PyInstaller 分析阶段 --- a = Analysis( [main_path.as_posix()], pathex=[], binaries=[], datas=[ ], hiddenimports=[], hookspath=[build_pyinstaller_path / "hooks"], hooksconfig={}, runtime_hooks=[], excludes=[], noarchive=False, optimize=0, ) pyz = PYZ(a.pure) # --- 可执行文件构建阶段 --- exe = EXE( pyz, a.scripts, [], exclude_binaries=True, name='voice_dialogue', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=False, disable_windowed_traceback=False, argv_emulation=False, target_arch='arm64', codesign_identity=None, entitlements_file=None, ) coll = COLLECT( exe, a.binaries, a.datas, strip=False, upx=True, upx_exclude=[], name='voice_dialogue', ) # --- macOS .app 包配置 --- # app = BUNDLE( # coll, # name='voice_dialogue.app', # icon=None, # bundle_identifier=None, # )