Files
cmshoppe/cmshopee.spec
T

86 lines
2.0 KiB
RPMSpec
Raw Normal View History

2026-07-03 09:26:27 +08:00
# -*- 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 importlib.util
import os
2026-07-10 09:00:06 +08:00
from PyInstaller.utils.hooks import collect_data_files
2026-07-03 09:26:27 +08:00
block_cipher = None
try:
backports_tarfile_spec = importlib.util.find_spec("backports.tarfile")
except ModuleNotFoundError:
backports_tarfile_spec = None
if backports_tarfile_spec is None:
raise SystemExit(
"Missing backports.tarfile. Run: "
"py -3.10 -m pip install -r requirements-build.txt"
)
2026-07-10 09:00:06 +08:00
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")
2026-07-03 09:26:27 +08:00
a = Analysis(
["main.py"],
pathex=[],
binaries=[],
datas=default_prompt_datas + asset_datas,
2026-07-03 09:26:27 +08:00
hiddenimports=[
"PySide6.QtCore",
"PySide6.QtGui",
"PySide6.QtWidgets",
"backports.tarfile",
2026-07-03 09:26:27 +08:00
],
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,
2026-07-03 09:26:27 +08:00
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name="cmshopee",
)