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
|
|
|
|
|
|
|
|
|
|
"${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
|