2020-08-06 03:09:49 -04:00
|
|
|
#!/usr/bin/env bash
|
2024-02-23 13:01:10 -05:00
|
|
|
Red='\033[0;31m' # Red
|
|
|
|
|
Color_Off='\033[0m' # Text Reset
|
|
|
|
|
|
[ADD] poetry: pin a dependency per architecture
factur-x >= 4.0 needs saxonche, which Saxonica ships no s390x wheel for.
Pin 3.x there, 4.2+ everywhere else.
PEP 508 markers now survive the whole chain: kept instead of evaluated,
and each line reaches "poetry add" as a single argument -- the
"grep -v ';'" silently dropped them. Since "poetry add" dedupes by name,
the multi-constraint form, which the CLI cannot express, is written back
into the pyproject and the lock regenerated.
PyMuPDF is set aside on s390x for the same reason: MuPDF does not build
there. Along the way, the ignore list missed pymssql, whose key carried
its version, and two pre-existing solver deadlocks, lxml-html-clean and
s3fs, blocked any regeneration.
--- FR ---
factur-x >= 4.0 dépend de saxonche, sans roue s390x chez Saxonica. On
épingle la 3.x là-bas, la 4.2+ ailleurs.
Le marqueur PEP 508 traverse maintenant la chaîne : il est conservé au
lieu d'être évalué, et chaque ligne devient un seul argument de « poetry
add » — le « grep -v ';' » écartait ces lignes en silence. « poetry add »
dédupliquant par nom, la forme multi-contraintes, hors de portée du CLI,
est réécrite dans le pyproject, puis le lock refait.
PyMuPDF est écarté sur s390x pour la même raison : MuPDF ne s'y construit
pas. Au passage, la liste d'ignorés ratait pymssql, dont la clé portait sa
version, et deux blocages préexistants du solveur, lxml-html-clean et
s3fs, interdisaient toute régénération.
Assisted-by: Claude Opus 5
2026-08-11 05:02:11 -04:00
|
|
|
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
|
|
|
|
|
|
[FIX] poetry update: run poetry in the Odoo venv, not the active one
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
2026-09-25 02:54:44 -04:00
|
|
|
# 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"
|
[ADD] poetry: pin a dependency per architecture
factur-x >= 4.0 needs saxonche, which Saxonica ships no s390x wheel for.
Pin 3.x there, 4.2+ everywhere else.
PEP 508 markers now survive the whole chain: kept instead of evaluated,
and each line reaches "poetry add" as a single argument -- the
"grep -v ';'" silently dropped them. Since "poetry add" dedupes by name,
the multi-constraint form, which the CLI cannot express, is written back
into the pyproject and the lock regenerated.
PyMuPDF is set aside on s390x for the same reason: MuPDF does not build
there. Along the way, the ignore list missed pymssql, whose key carried
its version, and two pre-existing solver deadlocks, lxml-html-clean and
s3fs, blocked any regeneration.
--- FR ---
factur-x >= 4.0 dépend de saxonche, sans roue s390x chez Saxonica. On
épingle la 3.x là-bas, la 4.2+ ailleurs.
Le marqueur PEP 508 traverse maintenant la chaîne : il est conservé au
lieu d'être évalué, et chaque ligne devient un seul argument de « poetry
add » — le « grep -v ';' » écartait ces lignes en silence. « poetry add »
dédupliquant par nom, la forme multi-contraintes, hors de portée du CLI,
est réécrite dans le pyproject, puis le lock refait.
PyMuPDF est écarté sur s390x pour la même raison : MuPDF ne s'y construit
pas. Au passage, la liste d'ignorés ratait pymssql, dont la clé portait sa
version, et deux blocages préexistants du solveur, lxml-html-clean et
s3fs, interdisaient toute régénération.
Assisted-by: Claude Opus 5
2026-08-11 05:02:11 -04:00
|
|
|
"${VENV}/bin/poetry" add -vv "${DEPS[@]}"
|
2021-06-27 00:22:22 -04:00
|
|
|
retVal=$?
|
|
|
|
|
if [[ $retVal -ne 0 ]]; then
|
2024-02-23 13:01:10 -05:00
|
|
|
echo -e "${Red}Error${Color_Off} ./script/poetry/poetry_add_build_dependency.sh"
|
2021-06-27 00:22:22 -04:00
|
|
|
exit 1
|
|
|
|
|
fi
|