From 6064d96138e6da5bfd86fd61e6f2e16c460bfe94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Thu, 7 May 2026 10:05:44 +0200 Subject: [PATCH] Flatpak packaging: desktop entry, MIME, distributable bundle org.testium.Testium.yaml uses host Python/Lua only (no bundled interpreter). build.sh exports a .flatpak bundle. README documents the install procedure. --- .gitignore | 2 ++ README.md | 14 +++++++- package/flatpak/build.sh | 20 ++++++++++- package/flatpak/org.testium.Testium-mime.xml | 7 ++++ package/flatpak/org.testium.Testium.desktop | 10 ++++++ package/flatpak/org.testium.Testium.yaml | 37 ++++++++++++++++---- 6 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 package/flatpak/org.testium.Testium-mime.xml create mode 100644 package/flatpak/org.testium.Testium.desktop diff --git a/.gitignore b/.gitignore index 990930b..ad2467a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ dist /.vscode .venv/ .flatpak-builder/ +package/flatpak/repo/ +package/flatpak/*.flatpak crash.tx* report_test.tx* *.autosave diff --git a/README.md b/README.md index a526e3e..969a125 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,19 @@ Pre-built artifacts are published at runnable directly, no Python installation required on the host. Lua support still needs a system `lua` interpreter and the `lua-socket` / `lua-cjson` modules. -* **Flatpak** — *coming soon.* +* **Flatpak bundle** (`testium.flatpak`) — install with: + + ```sh + # Add Flathub (once, to fetch the KDE/PySide runtimes) + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + + # Install the bundle + flatpak install --user testium.flatpak + ``` + + After installation testium appears in the desktop application menu and the + `testium` command is available in the terminal (requires `~/.local/bin` in + `PATH`, which most modern distributions provide by default). ## Quick start diff --git a/package/flatpak/build.sh b/package/flatpak/build.sh index 1d017f6..812a5da 100755 --- a/package/flatpak/build.sh +++ b/package/flatpak/build.sh @@ -5,4 +5,22 @@ # flatpak install flathub org.kde.Sdk//6.10 # flatpak install flathub io.qt.PySide.BaseApp//6.10 -flatpak-builder --user --verbose --force-clean --install build org.testium.Testium.yaml +set -e + +# Build + install local +flatpak-builder --user --verbose --force-clean --install --repo=repo build org.testium.Testium.yaml + +# Génère le bundle distribuable +flatpak build-bundle repo testium.flatpak org.testium.Testium +echo "Bundle généré : $(pwd)/testium.flatpak" + +# Crée ~/.local/bin/testium pour pouvoir taper "testium" en console +WRAPPER="$HOME/.local/bin/testium" +mkdir -p "$HOME/.local/bin" +cat > "$WRAPPER" <<'EOF' +#!/bin/sh +exec flatpak run org.testium.Testium "$@" +EOF +chmod +x "$WRAPPER" +echo "Wrapper installé : $WRAPPER" +echo "Assurez-vous que ~/.local/bin est dans votre PATH." diff --git a/package/flatpak/org.testium.Testium-mime.xml b/package/flatpak/org.testium.Testium-mime.xml new file mode 100644 index 0000000..3ccdffc --- /dev/null +++ b/package/flatpak/org.testium.Testium-mime.xml @@ -0,0 +1,7 @@ + + + + Testium test script + + + diff --git a/package/flatpak/org.testium.Testium.desktop b/package/flatpak/org.testium.Testium.desktop new file mode 100644 index 0000000..8a397de --- /dev/null +++ b/package/flatpak/org.testium.Testium.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Testium +GenericName=Test Sequencer +Comment=YAML-based test sequencer and runner +Exec=testium %f +Icon=org.testium.Testium +Type=Application +Categories=Development; +MimeType=application/x-testium; +StartupNotify=true diff --git a/package/flatpak/org.testium.Testium.yaml b/package/flatpak/org.testium.Testium.yaml index dcf3e06..68d2c04 100644 --- a/package/flatpak/org.testium.Testium.yaml +++ b/package/flatpak/org.testium.Testium.yaml @@ -13,7 +13,9 @@ finish-args: - --socket=wayland - --device=dri - --share=network - - --filesystem=home # Optionnel : si votre testium doit lire des fichiers utilisateurs + - --filesystem=home + - --filesystem=/tmp + - --filesystem=host-os build-options: build-args: @@ -41,18 +43,41 @@ modules: sources: - type: dir path: ../../src + - type: file + path: org.testium.Testium.desktop + - type: file + path: org.testium.Testium-mime.xml + - type: file + path: ../../package/testium.png build-commands: - # On installe le code source dans /app/lib/testium + # Code source - mkdir -p /app/lib - - cp -r . /app/lib/ + - cp -r testium /app/lib/ + - cp VERSION /app/lib/testium/VERSION - # Création du launcher exécutable + # Launcher exécutable - mkdir -p /app/bin - | cat < /app/bin/testium #!/bin/sh - # On ajoute le code source et l'extension PySide6 au PYTHONPATH + export TESTIUM_VERSION="\$(cat /app/lib/testium/VERSION 2>/dev/null || echo unknown)" export PYTHONPATH="/app/lib/testium:/usr/lib/sdk/pyside6/lib/python3.13/site-packages:\$PYTHONPATH" - exec python3 /app/lib/testium "\$@" + # Expose host binaries (git, python3, lua, …) for subprocess lookups. + # PATH is appended (not prepended) so the main process keeps the sandbox python3. + export PATH="\$PATH:/run/host/usr/local/bin:/run/host/usr/bin:/run/host/bin" + export GIT_PYTHON_GIT_EXECUTABLE="/run/host/usr/bin/git" + exec /usr/bin/python3 /app/lib/testium "\$@" EOF - chmod +x /app/bin/testium + + # Icône + - mkdir -p /app/share/icons/hicolor/256x256/apps + - cp testium.png /app/share/icons/hicolor/256x256/apps/org.testium.Testium.png + + # Entrée menu + - mkdir -p /app/share/applications + - cp org.testium.Testium.desktop /app/share/applications/ + + # Type MIME pour .tum + - mkdir -p /app/share/mime/packages + - cp org.testium.Testium-mime.xml /app/share/mime/packages/