fix: harden cross-platform quality tooling

This commit is contained in:
Rijad Zuzo
2026-07-30 13:42:38 +02:00
parent e284d3774d
commit 5511c295a5
7 changed files with 370 additions and 95 deletions
+14 -2
View File
@@ -6,14 +6,26 @@ set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
python_formatter() {
local python_command
for python_command in python python3; do
if command -v "$python_command" &>/dev/null &&
"$python_command" -m gdtoolkit.formatter --help &>/dev/null 2>&1; then
echo "$python_command"
return 0
fi
done
return 1
}
# detect gdformat
FMT=()
if [[ -x "$ROOT/.venv/bin/gdformat" ]]; then
FMT=("$ROOT/.venv/bin/gdformat")
elif command -v gdformat &>/dev/null; then
FMT=(gdformat)
elif python -m gdtoolkit.formatter --help &>/dev/null 2>&1; then
FMT=(python -m gdtoolkit.formatter)
elif PYTHON_FORMATTER="$(python_formatter)"; then
FMT=("$PYTHON_FORMATTER" -m gdtoolkit.formatter)
fi
if [[ ${#FMT[@]} -eq 0 ]]; then