From a552430facbbff13bde274d303421a401d27b1aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Thu, 27 Aug 2026 02:40:30 +0200 Subject: [PATCH 1/2] Install only the Python requirements that are missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The refresh's dependency step reads requirements.txt, resolves each distribution it names, and installs only the ones absent from the interpreter, falling back to the user site when a system-wide write is refused. An interpreter that already carries libclang and jsonschema needs no install, and one marked externally managed under PEP 668 — the Debian and Ubuntu default — no longer ends the refresh before the catalog is derived. --- tools/refresh-binding.sh | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/tools/refresh-binding.sh b/tools/refresh-binding.sh index 81d0027..8db6ca6 100755 --- a/tools/refresh-binding.sh +++ b/tools/refresh-binding.sh @@ -124,8 +124,44 @@ CATALOG="$WORK_DIR/meos-idl.json" LIBMEOS="$PREFIX/lib/libmeos.so" STAMP="$WORK_DIR/.mdb-commit" +# What the parse needs is that the requirements are INSTALLED, not that pip ran: a plain +# `pip install` aborts with `error: externally-managed-environment` on the Debian/Ubuntu system +# interpreter (PEP 668), which failed the refresh on a machine that already had every requirement. +# So check the distributions first and install only what is missing, into the user site PEP 668 +# does allow when the interpreter refuses a system-wide write. +missing_python_reqs() { + python3 - "$MEOSAPI/requirements.txt" <<'PYREQ' +import re, sys +from importlib.metadata import PackageNotFoundError, version + +missing = [] +for line in open(sys.argv[1], encoding="utf-8"): + spec = line.split("#")[0].strip() + if not spec: + continue + name = re.split(r"[<>=!~;\[]", spec, maxsplit=1)[0].strip() + try: + version(name) + except PackageNotFoundError: + missing.append(name) +print(" ".join(missing)) +PYREQ +} + step "Python dependencies for the catalog parse" -python3 -m pip install --quiet -r "$MEOSAPI/requirements.txt" +reqs_missing="$(missing_python_reqs)" +if [ -z "$reqs_missing" ]; then + echo "every requirement in $MEOSAPI/requirements.txt is already installed" >&2 +else + echo "installing missing Python requirement(s): $reqs_missing" >&2 + python3 -m pip install --quiet -r "$MEOSAPI/requirements.txt" \ + || python3 -m pip install --quiet --user -r "$MEOSAPI/requirements.txt" + reqs_missing="$(missing_python_reqs)" + [ -z "$reqs_missing" ] || { + echo "refresh-binding.sh: Python requirement(s) still missing after install: $reqs_missing" >&2 + exit 1 + } +fi # The catalog (and, for native/FFI bindings, libmeos) — the slow leg. Skip it when the commit, # the family flags and the build-libmeos choice are all already current, unless --force. From 69c591913c4a8d14615acffef1e0298762218133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Thu, 27 Aug 2026 02:41:46 +0200 Subject: [PATCH 2/2] Exit zero from a refresh that succeeded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The closing summary prints its optional libmeos and jar lines from `if` blocks. An AND-list whose test is false was the script's last command and left the exit status at 1, so every consumer that builds neither — MobilityDuck and the other non-JVM bindings — saw a completed refresh report failure. --- tools/refresh-binding.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/refresh-binding.sh b/tools/refresh-binding.sh index 8db6ca6..9f31ace 100755 --- a/tools/refresh-binding.sh +++ b/tools/refresh-binding.sh @@ -213,5 +213,8 @@ export PREFIX CATALOG JAR step "Done — ${ENGINE:-binding} refreshed against MobilityDB $MDB_COMMIT" if [ -n "$CATALOG_DEST" ]; then echo " catalog : $BINDING/$CATALOG_DEST" >&2 else echo " catalog : $CATALOG" >&2; fi -[ -n "$LIBMEOS" ] && echo " libmeos : $LIBMEOS" >&2 -[ -n "$JAR" ] && echo " jmeos : $JAR ($JMEOS_COORDS)" >&2 +# `if` blocks, not `[ ... ] && echo`: an AND-list whose test is false is the script's last command +# and leaves its exit status at 1, so a binding that builds no libmeos and no jar — every non-JVM +# consumer, MobilityDuck among them — reported failure from a refresh that had just succeeded. +if [ -n "$LIBMEOS" ]; then echo " libmeos : $LIBMEOS" >&2; fi +if [ -n "$JAR" ]; then echo " jmeos : $JAR ($JMEOS_COORDS)" >&2; fi