fix(packaging): verify bundled startup dependencies
This commit is contained in:
+16
-9
@@ -3,7 +3,7 @@ id: T-703
|
||||
title: 修复打包版缺少 backports 并增加 EXE 启动自检
|
||||
phase: 8
|
||||
deps: [T-625]
|
||||
status: TODO
|
||||
status: DONE
|
||||
created: 2026-07-27
|
||||
---
|
||||
|
||||
@@ -61,14 +61,14 @@ ModuleNotFoundError: No module named 'backports'
|
||||
|
||||
## 验收要点
|
||||
|
||||
- [ ] 构建环境安装 `requirements-build.txt` 后可导入 `backports.tarfile`。
|
||||
- [ ] `cmshopee.spec` 显式包含 `backports.tarfile`,缺少依赖时构建立即失败。
|
||||
- [ ] `py -3.10 main.py --startup-smoke-test` 正常退出,不创建 GUI 或业务数据。
|
||||
- [ ] 构建脚本在压缩发布包前运行打包 EXE 启动自检,并处理非零退出和 30 秒超时。
|
||||
- [ ] 新打包的 `cmshopee.exe --startup-smoke-test` 返回 0,不再出现 `No module named 'backports'`。
|
||||
- [ ] 发布目录和 ZIP 不包含 `data/`、配置、数据库、图片、日志或登录态。
|
||||
- [ ] 本轮发布包关闭并隐藏会员订阅检测,但源码在打包后恢复当前开发状态。
|
||||
- [ ] 验证通过:
|
||||
- [x] 构建环境安装 `requirements-build.txt` 后可导入 `backports.tarfile`。
|
||||
- [x] `cmshopee.spec` 显式包含 `backports.tarfile`,缺少依赖时构建立即失败。
|
||||
- [x] `py -3.10 main.py --startup-smoke-test` 正常退出,不创建 GUI 或业务数据。
|
||||
- [x] 构建脚本在压缩发布包前运行打包 EXE 启动自检,并处理非零退出和 30 秒超时。
|
||||
- [x] 新打包的 `cmshopee.exe --startup-smoke-test` 返回 0,不再出现 `No module named 'backports'`。
|
||||
- [x] 发布目录和 ZIP 不包含 `data/`、配置、数据库、图片、日志或登录态。
|
||||
- [x] 本轮发布包关闭并隐藏会员订阅检测,但源码在打包后恢复当前开发状态。
|
||||
- [x] 验证通过:
|
||||
- `py -3.10 -m unittest discover -s tests -p test_packaging.py`
|
||||
- `py -3.10 -m unittest discover -s tests`
|
||||
- `py -3.10 -m ruff check app tests main.py`
|
||||
@@ -86,3 +86,10 @@ ModuleNotFoundError: No module named 'backports'
|
||||
## 执行记录
|
||||
|
||||
- 2026-07-27:根据 `0.1.5.2` 打包版真实启动异常创建任务。确认异常发生在 PyInstaller `pyi_rth_pkgres` 运行时钩子,早于 `main.py`;构建警告和发布目录共同证明 `setuptools` vendored `jaraco.context` 已收集、`backports` 未收集,与会员订阅临时开关无关。
|
||||
- 2026-07-27:`requirements-build.txt` 精确锁定 PyInstaller 6.11.1、pyinstaller-hooks-contrib 2026.6、setuptools 80.9.0 和 backports.tarfile 1.2.0;安装后确认 Python 3.10 可从独立分发目录导入 `backports.tarfile`。
|
||||
- 2026-07-27:`cmshopee.spec` 在分析前检查 `backports.tarfile`,缺失时给出构建依赖安装命令并中止;主程序 hidden import 显式包含该模块。真实构建日志已出现 `Analyzing hidden import 'backports.tarfile'`。
|
||||
- 2026-07-27:`main.py` 增加内部参数 `--startup-smoke-test`,在 `app.gui` 成功导入后直接返回 0,不创建 GUI 或进入数据、更新、会员、Chrome 和业务流程。构建脚本在 release 组装与 ZIP 压缩前以隐藏窗口运行打包 EXE,非零退出或 30 秒超时会失败并终止发布。
|
||||
- 2026-07-27:扩展打包回归测试,覆盖构建依赖版本、spec 依赖检查、源码启动自检和 PowerShell 自检顺序;既有版本格式断言同步兼容当前三段或四段纯数字版本,不修改用户当前 `app/version.py`。
|
||||
- 2026-07-27:真实运行 `scripts/build_exe.ps1` 成功,dist 和 release 两处 `cmshopee.exe --startup-smoke-test` 均返回 0,未再出现 `No module named 'backports'`。构建警告只剩可选的 `backports.zstd`,不影响当前依赖或启动。
|
||||
- 2026-07-27:按发布要求在构建期间临时关闭并隐藏会员订阅检测;生成 `release/蝦皮圈優化助手0.1.5.2.zip` 后已精确恢复源码开关,`app/gui/main_window.py` 无未提交差异。新 ZIP 大小 71,420,205 字节,SHA-256 为 `d1929859b178ac409725c885a936b96109afc1840bc6dd2b74064089e158506f`。
|
||||
- 2026-07-27:验证通过:`py -3.10 -m unittest discover -s tests -p test_packaging.py`(12 项)、`py -3.10 -m unittest discover -s tests`(702 项)、`py -3.10 -m ruff check app tests main.py`、`py -3.10 -m compileall app main.py`、`powershell -ExecutionPolicy Bypass -File scripts\build_exe.ps1`、release EXE 启动自检和 `git diff --check`。
|
||||
|
||||
Reference in New Issue
Block a user