mise lays down a precompiled CPython where pyenv builds one: seconds against one to three minutes, with no -dev package at all. The choice lives in EL_PYTHON_PROVIDER -- auto, mise or pyenv -- and in a single file, lib_python_provider.sh. The rest of the repository only knows venv paths and needs to know none of this. In auto mode an ALREADY installed interpreter wins, whichever provider put it there. mise is never installed on its own, "curl | sh" commits too much for a script to decide -- make install_mise carries that decision. MISE_PYTHON_COMPILE=false forbids it from quietly compiling: without that guard it would fall back to pyenv's own engine, giving us the slowness without the tooling. That is also what stopped gcc from collapsing while building CPython on a low-memory s390x guest, for nothing. One real bug falls along the way: a failed venv did not stop the install, which then went on and failed further down, far from the cause. --- FR --- mise pose un CPython précompilé là où pyenv en compile un : des secondes contre une à trois minutes, et aucun paquet -dev. Le choix vit dans EL_PYTHON_PROVIDER — auto, mise ou pyenv — et dans un seul fichier, lib_python_provider.sh. Le reste du dépôt ne connaît que des chemins de venv et n'a rien à savoir de tout cela. En mode auto, un interpréteur DÉJÀ posé l'emporte, quel qu'en soit le fournisseur. mise n'est jamais installé de lui-même, « curl | sh » engage trop pour qu'un script en décide — make install_mise porte cette décision. MISE_PYTHON_COMPILE=false lui interdit de compiler en silence : sans ce garde, il retomberait sur le moteur de pyenv, et nous aurions sa lenteur sans son outillage. C'est aussi ce qui a évité que gcc s'écroule en bâtissant CPython sur une VM s390x à faible mémoire, inutilement. Un vrai défaut tombe au passage : un venv raté n'arrêtait pas l'installation, qui continuait et échouait plus loin, loin de la cause. Assisted-by: Claude Opus 5
41 lines
1.3 KiB
Bash
Executable file
41 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# Check if all 3 parameters are present
|
|
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
|
|
echo "Error: One or more parameters are missing."
|
|
echo "Usage: $0 <Context> <Venv_Path> <Python_Version>"
|
|
exit 1
|
|
fi
|
|
|
|
# Assign arguments to variables
|
|
CONTEXT="$1"
|
|
VENV_PATH="$2"
|
|
PYTHON_VERSION="$3"
|
|
|
|
# Display variables (for verification)
|
|
echo "Context: $CONTEXT"
|
|
echo "Venv Path: $VENV_PATH"
|
|
echo "Python Version: $PYTHON_VERSION"
|
|
|
|
# Le CHOIX du fournisseur (mise ou pyenv) vit dans la bibliothèque : ce script
|
|
# ne connaît qu'un chemin d'interpréteur. C'est ce qui permet d'en ajouter un
|
|
# troisième sans toucher ici.
|
|
# shellcheck source=script/install/lib_python_provider.sh
|
|
. ./script/install/lib_python_provider.sh
|
|
|
|
PYTHON_EXEC="$(el_python_exec "${PYTHON_VERSION}")"
|
|
if [[ -z "${PYTHON_EXEC}" ]] || [[ ! -x "${PYTHON_EXEC}" ]]; then
|
|
echo "Aucun interpreteur Python ${PYTHON_VERSION} n'a pu etre obtenu."
|
|
echo " Fournisseur demande : ${EL_PYTHON_PROVIDER:-auto}"
|
|
echo " Voir 'make install_mise', ou installez pyenv."
|
|
exit 1
|
|
fi
|
|
echo "Interpreteur retenu : ${PYTHON_EXEC}"
|
|
|
|
if [[ ! -d ${VENV_PATH} ]]; then
|
|
echo -e "\n---- Create Virtual environment Python ----"
|
|
if ! "${PYTHON_EXEC}" -m venv "${VENV_PATH}"; then
|
|
echo "Virtual environment, error when creating ${VENV_PATH}"
|
|
exit 1
|
|
fi
|
|
fi
|