Files
computer-playbook/scripts/install/python.sh
T
kevinveenbirkenbachandClaude Opus 4.7 80c396b839 refactor(env+install/spot): collapse python/venv resolution into shell SPOT
Pulls VENV/PYTHON/PIP/PYTHONPATH out of the dotenv handler pipeline
into scripts/meta/python/detect.sh. load.sh now sources detect.sh and
prepends ${VENV}/bin to PATH above the INFINITO_ENV_LOADED guard, so
every BASH_ENV re-entry re-resolves PYTHON the moment a venv
materialises mid-chain — the same fix as b79ed2869 but at the SPOT,
which retires the reload-trick from ansible.sh, python.sh and
pre-commit.sh.

Also renames INVENTORY_VARS_FILE → INFINITO_INVENTORY_VARS_FILE under
the new env-prefix lint, drops the 5 dead INFINITO_ENV_*_LOADED unsets
left over from the multi-loader era, and adds a lint guarding the
INFINITO_ prefix invariant on env/*.env keys.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 00:39:52 +02:00

44 lines
805 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
: "${PYTHON:?PYTHON not set}"
EXTRA="${1:-}"
retry() {
local attempts=7
local delay=20
local count=1
while true; do
if "$@"; then
return 0
fi
if [[ $count -ge $attempts ]]; then
echo "❌ Command failed after ${attempts} attempts."
return 1
fi
echo "⚠️ Attempt ${count}/${attempts} failed. Retrying in ${delay}s..."
sleep "${delay}"
((count++))
done
}
install_python_deps() {
echo "📦 Installing Python dependencies"
retry "${PYTHON}" -m pip install --upgrade pip setuptools wheel
if [[ -n "${EXTRA}" ]]; then
echo "→ Installing with extras: [${EXTRA}]"
retry "${PYTHON}" -m pip install -e ".[${EXTRA}]"
else
echo "→ Installing base package"
retry "${PYTHON}" -m pip install -e .
fi
}
install_python_deps