From 008288d7a5668c1ac8711663cfa6227959b15776 Mon Sep 17 00:00:00 2001 From: argszero Date: Wed, 5 Aug 2026 02:28:29 +0800 Subject: [PATCH] =?UTF-8?q?emrg:=20build-release=20=E5=8D=81=E4=B8=83?= =?UTF-8?q?=E6=AC=A1=E4=BF=AE=E5=A4=8D=20=E2=80=94=20Windows=20bin/python?= =?UTF-8?q?=20=E7=BC=BA=20DLL=20+=20emrg/emrgd=20=E6=8E=A2=E6=B5=8B?= =?UTF-8?q?=EF=BC=88rant=20#13=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第 17 次实跑:3/4 平台成功,Windows Inno Setup 编译通过(iscc 版本 打印 + artifacts 生成),新失败在 smoke-test:7 pass / 4 fail。 4 个 fail 同一根因——安装后 bin/python(复制品)缺 DLL 不可用: 1. emrg --version → bin/emrg exec bin/python → 失败 2. daemon port file → bin/emrgd exec bin/python → 失败 4. server stop → 依赖 daemon → 失败 7. python+deps → PATH 里 python(复制品缺 DLL)→ 失败 (前轮修的 emrg.cmd/emrgd.cmd 已用 python-dist,但 bash 版 bin/emrg/ emrgd 仍 exec bin/python;python-build-standalone DLL 在 python-dist/ 根) 修复(3 文件): 1. bin/emrg:exec 前探测 python-dist/python.exe(Windows),POSIX 保持 bin/python 软链(R100) 2. bin/emrgd:同上 3. build-runtime.sh 第 2 步:Windows 复制 python-dist 根目录 *.dll 到 bin/(使 PATH 里的 python 命令可用——session-scoped 脚本依赖) 验证: - bash -n OK(3 文件) - Windows/POSIX 双场景 PY_BIN 探测模拟正确;DLL 复制模拟正确 - 本机 macOS 实跑 build-runtime.sh 完整成功(83M + pip deps) - pytest 464 passed;import checks OK --- bin/emrg | 10 +++++++++- bin/emrgd | 10 +++++++++- packaging/build-runtime.sh | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/bin/emrg b/bin/emrg index 78aaca60..a3439c28 100755 --- a/bin/emrg +++ b/bin/emrg @@ -22,4 +22,12 @@ PREFIX="$(dirname "$DIR")" export PATH="$DIR:$PATH" export PYTHONPATH="$PREFIX/source:$PREFIX/lib:$PYTHONPATH" export PYTHONDONTWRITEBYTECODE=1 -exec "$DIR/python" -m emrg "$@" +# R100: Windows 下 bin/python(复制品)缺 DLL 不可用(DLL 在 python-dist/ 根)→ +# 探测 python-dist 里的 exe(与 emrg.cmd 一致);POSIX 用 bin/python 软链。 +PY_BIN="$DIR/python" +if [ -e "$DIR/python-dist/python.exe" ]; then + PY_BIN="$DIR/python-dist/python.exe" +elif [ -e "$DIR/python-dist/python3.13.exe" ]; then + PY_BIN="$DIR/python-dist/python3.13.exe" +fi +exec "$PY_BIN" -m emrg "$@" diff --git a/bin/emrgd b/bin/emrgd index 87497f0b..82c71ff0 100755 --- a/bin/emrgd +++ b/bin/emrgd @@ -16,4 +16,12 @@ PREFIX="$(dirname "$DIR")" export PATH="$DIR:$PATH" export PYTHONPATH="$PREFIX/source:$PREFIX/lib:$PYTHONPATH" export PYTHONDONTWRITEBYTECODE=1 -exec "$DIR/python" -m emrg.server "$@" +# R100: Windows 下 bin/python(复制品)缺 DLL 不可用(DLL 在 python-dist/ 根)→ +# 探测 python-dist 里的 exe(与 emrgd.cmd 一致);POSIX 用 bin/python 软链。 +PY_BIN="$DIR/python" +if [ -e "$DIR/python-dist/python.exe" ]; then + PY_BIN="$DIR/python-dist/python.exe" +elif [ -e "$DIR/python-dist/python3.13.exe" ]; then + PY_BIN="$DIR/python-dist/python3.13.exe" +fi +exec "$PY_BIN" -m emrg.server "$@" diff --git a/packaging/build-runtime.sh b/packaging/build-runtime.sh index 6dd3799a..404d5ef8 100755 --- a/packaging/build-runtime.sh +++ b/packaging/build-runtime.sh @@ -55,6 +55,11 @@ cp -R "$PY_ROOT/." "$DIST/bin/python-dist/" # Windows:Git Bash 的 ln -s 需管理员权限(软链创建失败)→ 用复制替代 cp "$PYEXE" python.exe cp "$PYEXE" python3.exe + # R100:python-build-standalone 的 DLL(python313.dll/vcruntime140*.dll 等) + # 在 python-dist/ 根目录——bin/python.exe 复制品缺 DLL 不可用(Windows loader + # 找不到 → 启动失败)。把根目录 *.dll 一并复制到 bin/,使 PATH 里的 + # python 命令(session-scoped 脚本)可用。 + cp python-dist/*.dll . 2>/dev/null || true else ln -sfn python-dist/bin/python3.13 python ln -sfn python-dist/bin/python3.13 python3