From 5951c46df9e46efa907ec1376323a937b30f8edb Mon Sep 17 00:00:00 2001 From: edraft Date: Fri, 16 Jan 2026 16:10:02 +0100 Subject: [PATCH] Fixed test action installation --- .gitea/workflows/test_before_merge.yaml | 4 ++- install.sh | 43 +++++++++++++------------ 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.gitea/workflows/test_before_merge.yaml b/.gitea/workflows/test_before_merge.yaml index aa52e8c3..0c1e35a9 100644 --- a/.gitea/workflows/test_before_merge.yaml +++ b/.gitea/workflows/test_before_merge.yaml @@ -36,7 +36,9 @@ jobs: - name: Setting up Python 3.12 run: | - python3.12 -m pip install -r src/requirements-dev.txt + apt install python3-dev -y + bash ./install.sh + bash ./install.sh -dev - name: Testing with pytest run: | diff --git a/install.sh b/install.sh index 460a27a2..96027d34 100644 --- a/install.sh +++ b/install.sh @@ -1,61 +1,64 @@ #!/usr/bin/env bash set -euo pipefail -# Find and combine requirements from src/*/requirements.txt, -# filtering out lines whose *package name* starts with "cpl-". -# Works with pinned versions, extras, markers, editable installs, and VCS refs. +# Optionaler Dev-Installationsmodus +dev_mode=false +if [[ "${1:-}" == "-dev" ]]; then + dev_mode=true +fi shopt -s nullglob -req_files=(src/*/requirements.txt) +# Wähle die passende Requirements-Datei +pattern='requirements.txt' +msg_hint='src/*/requirements.txt' +if $dev_mode; then + pattern='requirements.dev.txt' + msg_hint='src/*/requirements.dev.txt' +fi + +req_files=(src/*/"$pattern") if ((${#req_files[@]} == 0)); then - echo "No requirements files found at src/*/requirements.txt" >&2 + echo "Keine Requirements-Dateien gefunden unter '$msg_hint'" >&2 exit 1 fi tmp_combined="$(mktemp)" trap 'rm -f "$tmp_combined"' EXIT -# Concatenate, trim comments/whitespace, filter out cpl-* packages, dedupe. -# We keep non-package options/flags/constraints as-is. +# Kombiniere, filtere Kommentare/Whitespace, entferne cpl-*, dedupliziere. awk ' function trim(s){ sub(/^[[:space:]]+/,"",s); sub(/[[:space:]]+$/,"",s); return s } { line=$0 - # drop full-line comments and strip inline comments if (line ~ /^[[:space:]]*#/) next - sub(/#[^!].*$/,"",line) # strip trailing comment (simple heuristic) + sub(/#[^!].*$/,"",line) line=trim(line) if (line == "") next - # Determine the package *name* even for "-e", extras, pins, markers, or VCS "@" e = line - sub(/^-e[[:space:]]+/,"",e) # remove editable prefix - # Tokenize up to the first of these separators: space, [ < > = ! ~ ; @ + sub(/^-e[[:space:]]+/,"",e) token = e - sub(/\[.*/,"",token) # remove extras quickly + sub(/\[.*/,"",token) n = split(token, a, /[<>=!~;@[:space:]]/) name = tolower(a[1]) - # If the first token (name) starts with "cpl-", skip this requirement if (name ~ /^cpl-/) next - print line } ' "${req_files[@]}" | sort -u > "$tmp_combined" if ! [ -s "$tmp_combined" ]; then - echo "Nothing to install after filtering out cpl-* packages." >&2 + echo "Nichts zu installieren nach dem Entfernen von cpl-* Paketen." >&2 exit 0 fi -echo "Installing dependencies (excluding cpl-*) from:" +echo "Installiere Abhängigkeiten (ohne cpl-*) aus:" printf ' - %s\n' "${req_files[@]}" echo -echo "Final set to install:" +echo "Finale Menge zur Installation:" cat "$tmp_combined" echo -# Use python -m pip for reliability; change to python3 if needed. -python -m pip install -r "$tmp_combined" +python -m pip install -r "$tmp_combined" \ No newline at end of file