Poetry works in the active virtualenv when VIRTUAL_ENV is set. Launched from a shell under .venv.erplibre, poetry add and poetry lock inherited its Python, outside the pyproject bounds, and failed with InvalidCurrentPythonVersionError. Both calls now activate the Odoo venv of the ERPLibre version, as install_locally.sh already does. Checked: poetry env info -p reports .venv.erplibre before, the Odoo venv after, for the shell script and for the Python call alike. --- FR --- [FIX] poetry update : poetry dans le venv Odoo, pas dans le venv actif Poetry travaille dans le virtualenv actif quand VIRTUAL_ENV est posé. Lancés d'un shell sous .venv.erplibre, poetry add et poetry lock en héritaient le Python, hors des bornes du pyproject, et échouaient sur InvalidCurrentPythonVersionError. Les deux appels activent désormais le venv Odoo de la version ERPLibre, comme le fait déjà install_locally.sh. Vérifié : poetry env info -p donne .venv.erplibre avant, le venv Odoo après, pour le script shell comme pour l'appel Python. Assisted-by: Claude Opus 5.5
34 lines
1.3 KiB
Bash
Executable file
34 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
Red='\033[0;31m' # Red
|
|
Color_Off='\033[0m' # Text Reset
|
|
|
|
VENV="./.venv.$(cat ".erplibre-version" | xargs)"
|
|
BUILD="${VENV}/build_dependency.txt"
|
|
|
|
# Chaque ligne devient UN argument, jamais plusieurs.
|
|
#
|
|
# L'expansion « $(...) » non quotée découpait sur les espaces : une ligne
|
|
# portant un marqueur — « factur-x>=4.2 ; platform_machine != "s390x" » —
|
|
# arrivait à poetry en cinq arguments. D'où le « grep -v ';' » historique, qui
|
|
# écartait purement et simplement ces lignes : la dépendance n'était jamais
|
|
# ajoutée. Or « poetry add » sait lire une chaîne PEP 508 complète, marqueur
|
|
# compris — vérifié avec son propre parseur.
|
|
#
|
|
# On garde le filtre sur « * » : une contrainte joker n'apporte rien à poetry.
|
|
mapfile -t DEPS < <(grep -v '\*' "${BUILD}" | grep -v '^[[:space:]]*$')
|
|
|
|
if [[ ${#DEPS[@]} -eq 0 ]]; then
|
|
echo "Aucune dépendance à ajouter depuis ${BUILD}."
|
|
exit 0
|
|
fi
|
|
|
|
# poetry travaille dans le venv actif s'il y en a un : sans cette activation,
|
|
# un shell sous .venv.erplibre lui imposerait un Python hors des bornes du
|
|
# pyproject (InvalidCurrentPythonVersionError).
|
|
source "${VENV}/bin/activate"
|
|
"${VENV}/bin/poetry" add -vv "${DEPS[@]}"
|
|
retVal=$?
|
|
if [[ $retVal -ne 0 ]]; then
|
|
echo -e "${Red}Error${Color_Off} ./script/poetry/poetry_add_build_dependency.sh"
|
|
exit 1
|
|
fi
|