# -*- 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 from PyInstaller.utils.hooks import collect_data_files 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" ) 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", "backports.tarfile", ], 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", )