read_until:
- 'expected' now accepts a list of values (succeeds on any match).
- new 'regex: true' flag: each pattern is a Python regex (re.search over a
bounded tail, Console.REGEX_WINDOW). Reports which pattern matched.
Serial console robustness & clarity:
- failed open() raises a clear ETUMRuntimeError ("Serial device '…' does not
exist." / permission hint) instead of a raw pyserial traceback.
- a console whose open failed is safely "not open" (init _thd=None +
isOpened guards in readchar/read_nowait/close) — no more cascading
AttributeError: '_thd' on subsequent read steps.
- action handlers: one-liner for expected (ETUMRuntimeError) errors, full
traceback kept for unexpected ones. All console errors use testium
exceptions (ETUMRuntimeError).
Flatpak: grant --device=all so serial adapters (/dev/ttyUSB*, /dev/ttyACM*)
are visible in the sandbox.
Validation: new read_until list/regex (match + no-match) cases in
items/console/test.tum.
Version: 0.3.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
110 lines
4.0 KiB
YAML
110 lines
4.0 KiB
YAML
app-id: org.testium.Testium
|
|
runtime: org.kde.Platform
|
|
runtime-version: '6.10'
|
|
|
|
sdk: org.kde.Sdk
|
|
base: io.qt.PySide.BaseApp
|
|
base-version: '6.10' # Doit correspondre au runtime
|
|
command: testium
|
|
|
|
finish-args:
|
|
- --share=ipc
|
|
- --socket=fallback-x11
|
|
- --socket=wayland
|
|
# Expose all host devices to the sandbox. testium is a hardware-in-the-loop
|
|
# test tool: the console item must reach serial adapters (/dev/ttyUSB*,
|
|
# /dev/ttyACM*, …) which are otherwise invisible in the sandbox. --device=all
|
|
# also covers the GPU (supersedes --device=dri).
|
|
- --device=all
|
|
- --share=network
|
|
- --filesystem=home
|
|
- --filesystem=/tmp
|
|
- --filesystem=host-os
|
|
# Allow flatpak-spawn --host to launch host binaries (Python, Lua, git…)
|
|
# outside the sandbox. Required because the sandbox glibc/ABI is
|
|
# incompatible with arbitrary host shared libraries — we route py_func and
|
|
# lua_func through the host instead.
|
|
- --talk-name=org.freedesktop.Flatpak
|
|
|
|
build-options:
|
|
build-args:
|
|
- "--share=network"
|
|
|
|
modules:
|
|
- python3-requirements.json
|
|
|
|
# Language-server deps for `testium lsp` (pygls + lsprotocol + cattrs + attrs
|
|
# + typing_extensions). Installed from PyPI at build time — the build already
|
|
# runs with --share=network (see build-options). The core runtime deps stay
|
|
# offline-pinned in python3-requirements.json; these are pure-python wheels,
|
|
# hence --only-binary=:all: (no compilation, deterministic).
|
|
- name: python3-lsp
|
|
buildsystem: simple
|
|
build-options:
|
|
build-args:
|
|
- --share=network
|
|
build-commands:
|
|
# Whole command single-quoted: the ':all: ' colon-space would otherwise
|
|
# make YAML parse this list item as a mapping, silently dropping the
|
|
# command (flatpak-builder then runs an empty module — installs nothing).
|
|
- 'pip3 install --prefix=${FLATPAK_DEST} --only-binary=:all: "pygls>=1.3"'
|
|
|
|
# 1. Dépendances Python tierces (HORS PySide6)
|
|
# Utilisez flatpak-pip-generator pour vos autres libs (ex: pyserial, requests, etc.)
|
|
# - name: python3-requirements
|
|
# buildsystem: simple
|
|
# build-options:
|
|
# build-args:
|
|
# - --share=network
|
|
# build-commands:
|
|
# # --only-binary=:all: empêche la compilation et force le téléchargement des .whl
|
|
# - pip3 install --prefix=/app --only-binary=:all: -r requirements.txt
|
|
# sources:
|
|
# - type: file
|
|
# path: requirements.txt
|
|
|
|
# 2. Votre application (Code source dans ../../src)
|
|
- name: testium-app
|
|
buildsystem: simple
|
|
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:
|
|
# Code source
|
|
- mkdir -p /app/lib
|
|
- cp -r testium /app/lib/
|
|
- cp VERSION /app/lib/testium/VERSION
|
|
|
|
# Launcher exécutable
|
|
- mkdir -p /app/bin
|
|
- |
|
|
cat <<EOF > /app/bin/testium
|
|
#!/bin/sh
|
|
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"
|
|
# 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/
|