publishing: fix check_toolchain dying silently on a missing package

pip show exits non-zero for an absent package; under set -euo pipefail the
command substitution aborted build.sh before the self-heal could run — the
gate then failed the deploy with no message at all. Tolerate the missing
package (that is the case being healed) and report it.
This commit is contained in:
inference-bot committed 2026-11-12 03:30:11 +00:00
1 parent 1d36901a5e
commit b295b5a5b6
1 file changed
+4 -1
+4 -1
View File
@@ -53,7 +53,10 @@ check_toolchain() {
case "$req" in ''|\#*) continue ;; esac case "$req" in ''|\#*) continue ;; esac
pkg="${req%%[=<>!~]*}" pkg="${req%%[=<>!~]*}"
case "$req" in *==*) want="${req#*==}" ;; *) want="" ;; esac case "$req" in *==*) want="${req#*==}" ;; *) want="" ;; esac
have="$("$VENV/bin/pip" show "$pkg" 2>/dev/null | sed -n 's/^Version: //p')" # NB: the substitution must not fail the script under `set -euo pipefail`
# when the package is absent — a missing package is exactly the case this
# gate exists to heal, not an error to die on.
have="$({ "$VENV/bin/pip" show "$pkg" 2>/dev/null || true; } | sed -n 's/^Version: //p')"
if [ -z "$have" ] || { [ -n "$want" ] && [ "$have" != "$want" ]; }; then if [ -z "$have" ] || { [ -n "$want" ] && [ "$have" != "$want" ]; }; then
missing="$missing ${pkg}(${want:-any}; have: ${have:-none})" missing="$missing ${pkg}(${want:-any}; have: ${have:-none})"
fi fi