fix: detect broken venv and check ensurepip instead of venv --help
Some checks failed
Build and Push Docker Images / docker (push) Failing after 10s
Some checks failed
Build and Push Docker Images / docker (push) Failing after 10s
This commit is contained in:
@@ -65,9 +65,9 @@ check_deps() {
|
||||
command -v docker &>/dev/null || error "Docker est requis. Consultez https://docs.docker.com/engine/install/"
|
||||
command -v curl &>/dev/null || error "curl est requis : apt install curl"
|
||||
|
||||
# Vérifie que le module venv est disponible, sinon l'installe
|
||||
if ! python3 -m venv --help &>/dev/null; then
|
||||
info "Module venv manquant — installation automatique..."
|
||||
# Vérifie que ensurepip est disponible (requis pour créer un venv fonctionnel)
|
||||
if ! python3 -c "import ensurepip" &>/dev/null; then
|
||||
info "Module ensurepip/venv manquant — installation automatique..."
|
||||
PY_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
|
||||
if command -v apt-get &>/dev/null; then
|
||||
apt-get install -y "python${PY_VER}-venv" || error "Impossible d'installer python${PY_VER}-venv"
|
||||
@@ -168,8 +168,10 @@ fi
|
||||
download_files
|
||||
|
||||
# ─── Environnement virtuel ────────────────────────────────────────────────────
|
||||
if [[ ! -d "$INSTALL_DIR/venv" ]]; then
|
||||
# Recrée le venv si absent ou cassé (pip manquant)
|
||||
if [[ ! -x "$INSTALL_DIR/venv/bin/pip" ]]; then
|
||||
info "Création de l'environnement virtuel Python..."
|
||||
rm -rf "$INSTALL_DIR/venv"
|
||||
python3 -m venv "$INSTALL_DIR/venv"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user