Files
Jungfraujoch/make_doc.sh
T
leonarski_fandClaude Opus 5 8712160adb scripts: point the generated Python client at gitea, and make the scripts runnable
The openapi-generator invocation still passed --git-host=git.psi.ch and a user id of
jungfraujoch, from before the move to gitea.psi.ch/mx/jungfraujoch. Those properties are
not cosmetic: they become the source URL in the generated README and pyproject, so the
published client documentation - docs/python_client/README.md, which is copied out of the
generated tree - told readers to pip install from a host that no longer answers.
Regenerating with the corrected flags changes those two lines and nothing else, verified
against the committed tree.

update_version.sh, make_doc.sh and gen_python_client.sh were all mode 644, so the
"run update_version.sh" the documentation asks for fails on the shebang. CMake and the CI
both work around it by invoking them through bash.

make_doc.sh builds a throw-away venv in the working tree and deletes it on the last line,
which set -e skips whenever pip or sphinx fails - so a failed docs build left tmp_venv/
behind. Delete it from a trap instead, and ignore it along with the default output
directory and the sdist directory gen_python_client.sh creates.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 20:52:29 +02:00

48 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Build the Sphinx HTML documentation.
#
# Usage: make_doc.sh [output_dir]
# output_dir where the rendered HTML is written (default: ./public).
# Relative paths are resolved against the caller's working
# directory, so the frontend build can point this at frontend/dist/docs.
#
# The Python interpreter can be overridden with $PYTHON. Otherwise the newest
# available python3.x is used (the bare "python3" is often too old).
OUT="${1:-public}"
if [ -z "${PYTHON:-}" ]; then
for candidate in python3.13 python3.12 python3.11 python3; do
if command -v "$candidate" >/dev/null 2>&1; then
PYTHON="$candidate"
break
fi
done
fi
if [ -z "${PYTHON:-}" ]; then
echo "No python3 interpreter found" >&2
exit 1
fi
echo "Using $PYTHON ($("$PYTHON" --version 2>&1))"
# Resolve the output directory to an absolute path before we change directories.
mkdir -p "$OUT"
OUT="$(cd "$OUT" && pwd)"
# Run from the repository root regardless of where the script was invoked from.
cd "$(dirname "$0")"
# Remove the throw-away venv however we leave, so a failed pip/sphinx run does not litter the
# working tree (set -e would otherwise skip the cleanup below).
trap 'rm -rf tmp_venv/' EXIT
"$PYTHON" -m venv tmp_venv/
source tmp_venv/bin/activate
pip install -r docs/requirements.txt
sphinx-build -b html docs "$OUT"