#!/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 (default: python). OUT="${1:-public}" PYTHON="${PYTHON:-python}" # 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")" "$PYTHON" -m venv tmp_venv/ source tmp_venv/bin/activate pip install -r docs/requirements.txt sphinx-build -b html docs "$OUT" rm -rf tmp_venv/