Files
computer-playbook/scripts/install/pre-commit.sh
T
kevinveenbirkenbach c97f1d84e0 fix(install): ensure venv python is used for pip and pre-commit
Reload env layer in install scripts after venv creation so `PYTHON`
points to the virtualenv instead of the system interpreter.

* Reload env in `python.sh` before installing dependencies
* Reload env in `pre-commit.sh` before installing hooks
* Reset env cache flags to force re-evaluation
* Keep centralized environment resolution (no hardcoding)

Fixes PEP 668 `externally-managed-environment` errors and missing
`pre_commit` module during hook installation.
2026-04-08 21:21:37 +02:00

16 lines
445 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# 🔁 Reload env to pick up newly created venv
if [[ -n "${VENV:-}" && -x "${VENV}/bin/python" && "${PYTHON:-}" != "${VENV}/bin/python" ]]; then
unset INFINITO_ENV_LOADED
unset INFINITO_ENV_PYTHON_LOADED
# shellcheck source=scripts/meta/env/all.sh
source "${ENV_SH:-scripts/meta/env/all.sh}"
fi
: "${PYTHON:?PYTHON not set}"
echo "🔗 Installing pre-commit hooks"
"${PYTHON}" -m pre_commit install