Files
kevinveenbirkenbachandClaude Opus 5 f668082e8c fix(test): serialise the container-side dev-extras install
make test execs four targets into the same container and each one runs dev-extras.sh. The stamp guarding it was written after the install, so all four passed the check and ran concurrent pip install -e into a single venv, deleting each other's files mid-install. 1a908a6e5 introduced the fan-out; the retry loop in python.sh has masked the fallout ever since, at the cost of a silent fallback to serial pytest when it runs out of attempts.

Taking the lock before the stamp is read makes check, install and stamp one atomic section.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 10:28:43 +02:00

33 lines
913 B
Bash
Executable File

#!/usr/bin/env bash
# Install the dev extras into the resolved venv once. A stamp inside the
# venv skips reruns until pyproject.toml changes or the venv is recreated,
# so the container-side install disappears together with its venv.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
cd "${REPO_ROOT}"
# shellcheck source=scripts/meta/env/python.sh
source scripts/meta/env/python.sh
: "${VENV:?no venv resolved}"
STAMP="${VENV%/}/.dev-extras.stamp"
if [[ ! -w "${VENV}" ]]; then
echo "[dev-extras] venv not writable (${VENV}); skipping"
exit 0
fi
exec {lockfd}>"${VENV%/}/.dev-extras.lock"
flock "${lockfd}"
if [[ -f "${STAMP}" && "${STAMP}" -nt pyproject.toml ]]; then
echo "[dev-extras] up to date (${STAMP})"
exit 0
fi
bash scripts/install/python.sh dev
touch "${STAMP}"
echo "[dev-extras] installed and stamped (${STAMP})"