install_erplibre.sh bâtissait .venv.erplibre avec le python3 du système, quelle que soit sa version : un 3.10 y donnait un venv que l'outillage ne sait pas charger. Il délègue à install_venv.sh, qui obtient la version par mise, pyenv ou la distribution, et rebâtit un venv hors service. Le PATCH ne borne que le venv d'Odoo, dont le pyproject exige « >=3.12.10,<3.13 » : l'exiger ailleurs écartait un Python de distribution d'un cran en retard — NixOS 25.11 livre 3.14.2 — et faisait compiler CPython pour rien. Le module NixOS déclare désormais les DEUX Python, substitués depuis les fichiers de version. Vérifié : 15 tests sur des venvs factices, conservés, rebâtis ou refusés selon leur état, et un chemin sans pyvenv.cfg garde son contenu. --- EN --- install_erplibre.sh built .venv.erplibre with the system python3, whatever its version: a 3.10 gave a venv the tooling cannot load. It delegates to install_venv.sh, which obtains the version through mise, pyenv or the distribution, and rebuilds a venv out of service. The PATCH bounds only Odoo's venv, whose pyproject requires ">=3.12.10,<3.13": requiring it elsewhere turned away a distribution Python one step behind — NixOS 25.11 ships 3.14.2 — and compiled CPython for nothing. The NixOS module now declares BOTH Pythons, substituted from the version files. Checked: 15 tests on stub venvs, kept, rebuilt or refused by their state, and a path without pyvenv.cfg keeps its content. Assisted-by: Claude Opus 5
44 lines
1.7 KiB
Bash
Executable file
44 lines
1.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# Se lance depuis la racine du dépôt : ailleurs, le chemin de venv serait vide
|
|
# et la cible deviendrait « /bin/repo ».
|
|
CONF_VENV="conf/python-erplibre-venv"
|
|
if [[ ! -f "${CONF_VENV}" ]]; then
|
|
echo "Configuration introuvable : ${CONF_VENV}"
|
|
echo " cd <racine du depot> && ./script/install/install_git_repo.sh"
|
|
exit 1
|
|
fi
|
|
VENV_ERPLIBRE_PATH=$(xargs < "${CONF_VENV}")
|
|
|
|
VENV_REPO_PATH=${VENV_ERPLIBRE_PATH}/bin/repo
|
|
# Install git-repo if missing
|
|
if [[ ! -f ${VENV_REPO_PATH} ]]; then
|
|
if [[ ! -d "${VENV_ERPLIBRE_PATH}/bin" ]]; then
|
|
echo "Venv ${VENV_ERPLIBRE_PATH} absent : posez-le avant git-repo."
|
|
echo " ./script/install/install_erplibre.sh"
|
|
exit 1
|
|
fi
|
|
echo -e "\n---- Install git-repo from Google APIS ----"
|
|
# Téléchargé à côté, contrôlé, puis déplacé : sans « -f », curl écrit la
|
|
# page d'une erreur HTTP et rend 0 ; un corps vide passe le statut.
|
|
REPO_TMP="$(mktemp)" || exit 1
|
|
if ! curl -fsSL -o "${REPO_TMP}" \
|
|
https://storage.googleapis.com/git-repo-downloads/repo \
|
|
|| [[ ! -s "${REPO_TMP}" ]]; then
|
|
echo "Telechargement de git-repo impossible ou vide (reseau ou cache) :"
|
|
echo " ${VENV_REPO_PATH} n'est pas pose."
|
|
rm -f "${REPO_TMP}"
|
|
exit 1
|
|
fi
|
|
# Le hashbang du venv remplace celui du python3 du système.
|
|
sed -i 1d "${REPO_TMP}"
|
|
PYTHON_HASHBANG="#!./${VENV_ERPLIBRE_PATH}/bin/python"
|
|
sed -i "1 i ${PYTHON_HASHBANG}" "${REPO_TMP}"
|
|
if ! mv "${REPO_TMP}" "${VENV_REPO_PATH}"; then
|
|
echo "Mise en place de ${VENV_REPO_PATH} impossible."
|
|
rm -f "${REPO_TMP}"
|
|
exit 1
|
|
fi
|
|
# mktemp crée en 0600.
|
|
chmod 755 "${VENV_REPO_PATH}"
|
|
fi
|