fix(ci): avoid uv-managed python bootstrap on runners

This commit is contained in:
2026-03-24 14:25:46 +01:00
parent b7d122aa5b
commit 6f846d84d6
2 changed files with 35 additions and 43 deletions

27
scripts/ensure-ci-python.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
TARGET_VERSION="${1:-3.11}"
IFS="." read -r PYTHON_MAJOR PYTHON_MINOR _ <<< "${TARGET_VERSION}"
if [[ -n "${PYTHON_MINOR:-}" ]]; then
PYTHON_BIN="python${PYTHON_MAJOR}.${PYTHON_MINOR}"
else
PYTHON_BIN="python${PYTHON_MAJOR}"
fi
if command -v "${PYTHON_BIN}" >/dev/null 2>&1; then
command -v "${PYTHON_BIN}"
exit 0
fi
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update
apt-get install -y "${PYTHON_BIN}" "${PYTHON_BIN}-venv"
command -v "${PYTHON_BIN}"