Skip to content

emrg: build-release 十一次修复 — Windows python.exe 探测(rant #13) - #379

Merged
argszero merged 1 commit into
masterfrom
feature/build-release-fixes11
Aug 4, 2026
Merged

emrg: build-release 十一次修复 — Windows python.exe 探测(rant #13)#379
argszero merged 1 commit into
masterfrom
feature/build-release-fixes11

Conversation

@argszero

@argszero argszero commented Aug 4, 2026

Copy link
Copy Markdown
Owner

第 11 次实跑:3/4 平台成功(macOS + ubuntu×2,pipefail 修复生效),Windows 失败于 build-runtime.sh 第 4 步 pip install:exit 127(command not found)

根因:Git Bash 对带路径的直接执行不做 .exe 补全。Windows 复制产物为 bin/python.exe(bin/python 无扩展名文件不存在),而脚本用 "$DIST/bin/python"(无扩展名)调用 → bash 找不到文件 → 127。POSIX 有 python 软链所以正常。(bin/emrg.cmd 早已用 "%DIR%\\python.exe",印证引用方式差异。)

修复:PY_BIN 探测——bin/python 不存在且 bin/python.exe 存在时改用 .exe。用 -e(存在性)而非 -x(可执行),cp 复制的 exe 执行位在 Git Bash 中不可靠。

验证

  • bash -n OK
  • Windows(仅 python.exe)/ POSIX(仅 python 软链)双场景模拟正确
  • 本机 macOS 实跑 build-runtime.sh 完整成功(83M runtime,pip deps 安装 OK)
  • pytest 464 passed;import checks OK

背景:rant #13 Phase 4 发布期。合并后重打 tag 第 12 次实跑,预期 4/4 全绿 → Release 发布。

第 11 次实跑:3/4 平台成功(macOS + ubuntu×2,pipefail 修复生效),
Windows 失败于 build-runtime.sh 第 4 步 pip install:exit 127(command not found)。

根因:Git Bash 对带路径的直接执行不做 .exe 补全。Windows 复制产物为
bin/python.exe(bin/python 无扩展名文件不存在),而脚本用 `"$DIST/bin/python"`
(无扩展名)调用 → bash 找不到文件 → 127。POSIX 有 python 软链所以正常。
(bin/emrg.cmd 早已用 "%DIR%\python.exe",验证了引用方式差异。)

修复:PY_BIN 探测——bin/python 不存在且 bin/python.exe 存在时改用 .exe。
用 -e(存在性)而非 -x(可执行),cp 复制的 exe 执行位在 Git Bash 中不可靠。

验证:
- bash -n OK
- Windows(仅 python.exe)/ POSIX(仅 python 软链)双场景模拟正确
- 本机 macOS 实跑 build-runtime.sh 完整成功(83M runtime,pip deps 安装 OK)
- pytest 464 passed;import checks OK

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-0064

审查内容:build-runtime.sh PY_BIN 探测——bin/python 不存在且 bin/python.exe 存在时改用 .exe(Git Bash 带路径执行不做 .exe 补全 → 127)。

验证:bash -n OK;Windows/POSIX 双场景模拟正确;本机 macOS 实跑 build-runtime.sh 完整成功(83M + pip deps);pytest 464 passed。根因分析准确(第 11 次实跑 3/4 成功,仅 Windows pip 127)。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-0065

第二次复核:diff 与上轮一致(build-runtime.sh PY_BIN 探测——python 不存在且 python.exe 存在时切 .exe,用 -e 存在性检查)。bash -n OK;本机实跑成功验证过。无新增问题。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260805-0066

第三次复核:diff 稳定(build-runtime.sh PY_BIN 探测——python 不存在且 python.exe 存在时切 .exe,-e 存在性检查)。bash -n OK;本机 macOS 实跑 build-runtime.sh 完整成功(83M runtime + pip deps)。3 个不同 cycle(0064/0065/0066)连续 LGTM,满足合并条件。

@argszero
argszero merged commit 39ab5e1 into master Aug 4, 2026
1 check passed
argszero added a commit that referenced this pull request Aug 4, 2026
…380)

第 12 次实跑:3/4 平台成功,Windows 仍失败于 build-runtime.sh 第 4 步
pip install:exit 127(0.059s 即失败 = 命令未启动)。

根因:python-build-standalone Windows 版把 python313.dll 等 DLL 放在
python-dist/ 根目录。第 2 步把 python.exe 复制到 bin/ 后,DLL 不在 exe
目录也不在 PATH → Windows loader 找不到 DLL → 进程启动失败 → bash 报 127。
(PR #379 的 PY_BIN 探测已生效:bin/python.exe 存在,但 DLL 缺失。)

连带发现:bin/emrg.cmd 和 bin/emrgd.cmd 也用 bin/python.exe 复制品——
发布后的 Windows 用户启动同样会失败。同源修复。

修复(3 文件):
1. build-runtime.sh 第 4 步:Windows 直接用 python-dist/ 根目录的
   python.exe(与 DLL 同目录),POSIX 保持 bin/python 软链
2. bin/emrg.cmd:改用 %DIR%\python-dist\python.exe(不存在则回退
   python3.13.exe)
3. bin/emrgd.cmd:同上

验证:
- bash -n OK
- Windows(python-dist 根 exe)/ POSIX(软链)双场景模拟正确
- 本机 macOS 实跑 build-runtime.sh 完整成功(83M runtime,pip deps OK)
- pytest 464 passed;import checks OK
@argszero
argszero deleted the feature/build-release-fixes11 branch August 5, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant