2026-01-12 09:19:38 +08:00
|
|
|
|
# -*- mode: python ; coding: utf-8 -*-
|
2026-01-20 15:11:03 +08:00
|
|
|
|
|
2026-01-12 09:19:38 +08:00
|
|
|
|
import os
|
2026-01-20 15:11:03 +08:00
|
|
|
|
import sys
|
|
|
|
|
|
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
|
|
|
|
|
|
|
|
|
|
|
|
# 添加当前目录到路径
|
|
|
|
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
2026-01-12 09:19:38 +08:00
|
|
|
|
|
|
|
|
|
|
block_cipher = None
|
|
|
|
|
|
|
2026-01-20 15:11:03 +08:00
|
|
|
|
# 收集Playwright的数据文件
|
|
|
|
|
|
playwright_data = collect_data_files('playwright')
|
|
|
|
|
|
|
|
|
|
|
|
# 添加额外的隐藏导入
|
|
|
|
|
|
hiddenimports = [
|
|
|
|
|
|
'PySide6.Qt6Compat',
|
|
|
|
|
|
'loguru',
|
|
|
|
|
|
'playwright._impl._driver',
|
|
|
|
|
|
'playwright._impl._api_structures',
|
|
|
|
|
|
'playwright._impl._connection',
|
|
|
|
|
|
'playwright._impl._transport',
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# 排除PyQt5,避免冲突
|
|
|
|
|
|
excludes = ['PyQt5', 'PyQt6']
|
2026-01-12 09:19:38 +08:00
|
|
|
|
|
|
|
|
|
|
a = Analysis(
|
|
|
|
|
|
['main.py'],
|
2026-01-20 15:11:03 +08:00
|
|
|
|
pathex=[],
|
2026-01-12 09:19:38 +08:00
|
|
|
|
binaries=[],
|
2026-01-20 15:11:03 +08:00
|
|
|
|
datas=[
|
|
|
|
|
|
*playwright_data,
|
|
|
|
|
|
('guba.ico', '.'),
|
|
|
|
|
|
('indicator.ico', '.'),
|
|
|
|
|
|
('config.json', '.'),
|
|
|
|
|
|
],
|
|
|
|
|
|
hiddenimports=hiddenimports,
|
2026-01-12 09:19:38 +08:00
|
|
|
|
hookspath=[],
|
|
|
|
|
|
hooksconfig={},
|
|
|
|
|
|
runtime_hooks=[],
|
2026-01-20 15:11:03 +08:00
|
|
|
|
excludes=excludes,
|
2026-01-12 09:19:38 +08:00
|
|
|
|
win_no_prefer_redirects=False,
|
|
|
|
|
|
win_private_assemblies=False,
|
|
|
|
|
|
cipher=block_cipher,
|
|
|
|
|
|
noarchive=False,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-01-20 15:11:03 +08:00
|
|
|
|
# 添加必要的二进制文件
|
2026-01-12 09:19:38 +08:00
|
|
|
|
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
|
|
|
|
|
|
|
|
|
|
|
exe = EXE(
|
|
|
|
|
|
pyz,
|
|
|
|
|
|
a.scripts,
|
2026-01-20 15:11:03 +08:00
|
|
|
|
a.binaries,
|
|
|
|
|
|
a.datas,
|
2026-01-12 09:19:38 +08:00
|
|
|
|
[],
|
|
|
|
|
|
name='guba-indicator',
|
|
|
|
|
|
debug=False,
|
|
|
|
|
|
bootloader_ignore_signals=False,
|
|
|
|
|
|
strip=False,
|
|
|
|
|
|
upx=True,
|
2026-01-20 15:11:03 +08:00
|
|
|
|
upx_exclude=[],
|
|
|
|
|
|
runtime_tmpdir=None,
|
|
|
|
|
|
console=False, # 不显示控制台窗口
|
|
|
|
|
|
icon='guba.ico',
|
2026-01-12 09:19:38 +08:00
|
|
|
|
disable_windowed_traceback=False,
|
|
|
|
|
|
argv_emulation=False,
|
|
|
|
|
|
target_arch=None,
|
|
|
|
|
|
codesign_identity=None,
|
|
|
|
|
|
entitlements_file=None,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-01-20 15:11:03 +08:00
|
|
|
|
# 如果需要单文件,使用以下配置
|
2026-01-12 09:19:38 +08:00
|
|
|
|
coll = COLLECT(
|
|
|
|
|
|
exe,
|
|
|
|
|
|
a.binaries,
|
|
|
|
|
|
a.datas,
|
|
|
|
|
|
strip=False,
|
|
|
|
|
|
upx=True,
|
|
|
|
|
|
upx_exclude=[],
|
|
|
|
|
|
name='guba-indicator',
|
|
|
|
|
|
)
|