Files
cmshoppe/cmshopee.spec
T
chengmaandClaude Fable 5 049d4b6bbc feat(brand): add application logo for exe and window icon
新增品牌标识并接入运行时与打包流程。

- `scripts/gen_logo.py` 从单一几何定义同时产出 SVG 母版、多尺寸 ICO 和
  PNG 预览,避免母版与位图漂移;改样式改脚本后重新生成即可。
- 标记为暖橙圆角徽章 + 白色上升箭头(提升并发布)+ 四角星芒(AI 生成),
  刻意避开蝦皮官方购物袋标识,避免暗示官方关联。
- ICO 含 16/20/24/32/40/48/64/128/256 九档,每档从矢量几何独立渲染而非
  由大图缩放,保证任务栏与资源管理器小尺寸清晰。
- `app/assets` 作为可导入包提供无 Qt 依赖的路径解析,兼容源码树、
  PyInstaller onedir 的 _MEIPASS 与 exe 同级目录三种布局。
- `widgets.app_icon()` 在 Qt 缺失或资源未生成时返回 None,调用方容错;
  在 QApplication 上设置图标以便任务栏、对话框和消息框一并继承,
  MainWindow 另行设置以覆盖直接构造窗口的测试路径。
- 两个 spec 均加 `icon=`,主 spec 收集资源到 datas 并在资源缺失时直接
  报错提示先跑生成脚本。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 16:39:18 +08:00

75 lines
1.7 KiB
RPMSpec

# -*- mode: python ; coding: utf-8 -*-
"""PyInstaller spec for cmshopee Windows onedir builds.
Local user data is intentionally not bundled. The release package must not
include config files, SQLite databases, Chrome profiles, generated images,
logs, prompts, or other operator data.
"""
import os
from PyInstaller.utils.hooks import collect_data_files
block_cipher = None
default_prompt_datas = collect_data_files(
"app.default_prompts",
includes=["**/*.txt"],
)
# Window icon at runtime; the same file is the executable icon below.
asset_datas = collect_data_files(
"app.assets",
includes=["*.ico", "*.png", "**/*.ico", "**/*.png"],
)
if not asset_datas:
raise SystemExit(
"app/assets 下没有找到图标资源,请先运行:py -3.10 scripts/gen_logo.py"
)
APP_ICON = os.path.join(SPECPATH, "app", "assets", "cmshopee.ico")
a = Analysis(
["main.py"],
pathex=[],
binaries=[],
datas=default_prompt_datas + asset_datas,
hiddenimports=[
"PySide6.QtCore",
"PySide6.QtGui",
"PySide6.QtWidgets",
],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name="cmshopee",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
icon=APP_ICON,
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name="cmshopee",
)