build_all: incremental build + per-step toolchain install

Skip steps whose dist/ artifact already exists; add --clean/-c to
force a full rebuild. Install sphinx/linuxdoc, build, pyinstaller
in their respective steps instead of upfront. Auto-add flathub
remote and install missing Flatpak SDK/runtime deps before step 4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 13:51:22 +02:00
parent dd584c9064
commit a260e2a56c
3 changed files with 95 additions and 38 deletions

View File

@@ -8,6 +8,9 @@
# release_note.txt is copied to dist/ up front (with a warning if it has no # release_note.txt is copied to dist/ up front (with a warning if it has no
# entry for the current version). # entry for the current version).
# #
# By default, a step is skipped if its artifact already exists in dist/.
# Pass --clean to remove existing dist/ artifacts and rebuild everything.
#
# All artifacts are collected (copied) under <repo>/dist/. Original outputs in # All artifacts are collected (copied) under <repo>/dist/. Original outputs in
# src/dist/, package/*/dist/, doc/manual/ are left in place. Wheel and AppImage # src/dist/, package/*/dist/, doc/manual/ are left in place. Wheel and AppImage
# keep their original names (which already contain the version); manual, # keep their original names (which already contain the version); manual,
@@ -15,17 +18,35 @@
# #
# Re-uses scripts/build_env.sh and scripts/set_env.sh — the same pair invoked # Re-uses scripts/build_env.sh and scripts/set_env.sh — the same pair invoked
# by run.sh — so the venv at test/tmp/.venv stays the single source of Python # by run.sh — so the venv at test/tmp/.venv stays the single source of Python
# dependencies. `build` and `pyinstaller` are installed into that venv on # dependencies. `build`, `pyinstaller`, `sphinx` and `linuxdoc` are installed
# demand if not already there. Flatpak and AppImage build in their own # into that venv on demand if not already there. Flatpak and AppImage build in
# container/sandbox; their build.sh scripts have their own toolchain checks. # their own container/sandbox; their build.sh scripts have their own toolchain
# checks.
set -e set -e
CLEAN=0
for arg in "$@"; do
case "$arg" in
--clean|-c) CLEAN=1 ;;
*) echo "Unknown option: $arg" >&2; exit 1 ;;
esac
done
SCRIPT_DIR=$(realpath "$(dirname "$0")") SCRIPT_DIR=$(realpath "$(dirname "$0")")
VERSION=$(cat "$SCRIPT_DIR/src/VERSION") VERSION=$(cat "$SCRIPT_DIR/src/VERSION")
DIST_DIR="$SCRIPT_DIR/dist" DIST_DIR="$SCRIPT_DIR/dist"
mkdir -p "$DIST_DIR" mkdir -p "$DIST_DIR"
if [ "$CLEAN" -eq 1 ]; then
echo "-- clean: removing existing dist artifacts for version $VERSION"
rm -f "$DIST_DIR/testium-manual-${VERSION}.pdf"
rm -f "$DIST_DIR"/testium-${VERSION}-*.whl
rm -f "$DIST_DIR/testium-${VERSION}"
rm -f "$DIST_DIR/testium-${VERSION}.flatpak"
rm -f "$DIST_DIR"/Testium-${VERSION}-*.AppImage
fi
# Release note: copy it to dist/ and warn (but don't fail) if it has no entry # Release note: copy it to dist/ and warn (but don't fail) if it has no entry
# for the current version. # for the current version.
RELEASE_NOTE_SRC="$SCRIPT_DIR/release_note.txt" RELEASE_NOTE_SRC="$SCRIPT_DIR/release_note.txt"
@@ -42,9 +63,6 @@ export REQ_PATH="$SCRIPT_DIR/src/requirements.txt"
bash "$SCRIPT_DIR/scripts/build_env.sh" bash "$SCRIPT_DIR/scripts/build_env.sh"
source "$SCRIPT_DIR/scripts/set_env.sh" source "$SCRIPT_DIR/scripts/set_env.sh"
# Ensure wheel/PyInstaller toolchains are present in the venv.
python -m pip install --quiet --upgrade build pyinstaller
step() { step() {
echo echo
echo "================================================================" echo "================================================================"
@@ -52,15 +70,24 @@ step() {
echo "================================================================" echo "================================================================"
} }
skip() { echo " (already built — skipping)"; }
# 1. Manual PDF # 1. Manual PDF
step "1/5 Manual PDF (version $VERSION)"
bash "$SCRIPT_DIR/doc/manual/sphinx/build_doc.sh"
MANUAL_SRC="$SCRIPT_DIR/doc/manual/testium_manual.pdf"
MANUAL="$DIST_DIR/testium-manual-${VERSION}.pdf" MANUAL="$DIST_DIR/testium-manual-${VERSION}.pdf"
cp -f "$MANUAL_SRC" "$MANUAL" step "1/5 Manual PDF (version $VERSION)"
if [ ! -f "$MANUAL" ]; then
python -m pip install --quiet --upgrade sphinx linuxdoc
bash "$SCRIPT_DIR/doc/manual/sphinx/build_doc.sh"
cp -f "$SCRIPT_DIR/doc/manual/testium_manual.pdf" "$MANUAL"
else
skip
fi
# 2. Wheel — PEP 427 name kept (already contains version) # 2. Wheel — PEP 427 name kept (already contains version)
step "2/5 Wheel (version $VERSION)" step "2/5 Wheel (version $VERSION)"
WHEEL=$(ls -1t "$DIST_DIR"/testium-${VERSION}-*.whl 2>/dev/null | head -1)
if [ -z "$WHEEL" ]; then
python -m pip install --quiet --upgrade build
( (
cd "$SCRIPT_DIR/src" cd "$SCRIPT_DIR/src"
rm -rf dist build *.egg-info rm -rf dist build *.egg-info
@@ -69,26 +96,53 @@ step "2/5 Wheel (version $VERSION)"
WHEEL_SRC=$(ls -1t "$SCRIPT_DIR/src/dist"/*.whl | head -1) WHEEL_SRC=$(ls -1t "$SCRIPT_DIR/src/dist"/*.whl | head -1)
WHEEL="$DIST_DIR/$(basename "$WHEEL_SRC")" WHEEL="$DIST_DIR/$(basename "$WHEEL_SRC")"
cp -f "$WHEEL_SRC" "$WHEEL" cp -f "$WHEEL_SRC" "$WHEEL"
else
skip
fi
# 3. PyInstaller binary # 3. PyInstaller binary
step "3/5 PyInstaller binary (version $VERSION)"
bash "$SCRIPT_DIR/package/pyinstaller/build.sh"
PYI_SRC="$SCRIPT_DIR/package/pyinstaller/dist/testium"
PYI_BIN="$DIST_DIR/testium-${VERSION}" PYI_BIN="$DIST_DIR/testium-${VERSION}"
cp -f "$PYI_SRC" "$PYI_BIN" step "3/5 PyInstaller binary (version $VERSION)"
if [ ! -f "$PYI_BIN" ]; then
python -m pip install --quiet --upgrade pyinstaller
bash "$SCRIPT_DIR/package/pyinstaller/build.sh"
cp -f "$SCRIPT_DIR/package/pyinstaller/dist/testium" "$PYI_BIN"
else
skip
fi
# 4. Flatpak bundle # 4. Flatpak bundle
FLATPAK_BUNDLE="$DIST_DIR/testium-${VERSION}.flatpak"
step "4/5 Flatpak bundle (version $VERSION)" step "4/5 Flatpak bundle (version $VERSION)"
if [ ! -f "$FLATPAK_BUNDLE" ]; then
FLATPAK_DEPS=(
"org.kde.Platform//6.10"
"org.kde.Sdk//6.10"
"io.qt.PySide.BaseApp//6.10"
)
if ! flatpak remotes --user | grep -q "^flathub"; then
echo " Adding Flathub remote"
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
fi
for dep in "${FLATPAK_DEPS[@]}"; do
if ! flatpak info --user "$dep" &>/dev/null && ! flatpak info --system "$dep" &>/dev/null; then
echo " Installing Flatpak dependency: $dep"
flatpak install --user --noninteractive flathub "$dep"
fi
done
( (
cd "$SCRIPT_DIR/package/flatpak" cd "$SCRIPT_DIR/package/flatpak"
bash build.sh bash build.sh
) )
FLATPAK_SRC="$SCRIPT_DIR/package/flatpak/testium.flatpak" cp -f "$SCRIPT_DIR/package/flatpak/testium.flatpak" "$FLATPAK_BUNDLE"
FLATPAK_BUNDLE="$DIST_DIR/testium-${VERSION}.flatpak" else
cp -f "$FLATPAK_SRC" "$FLATPAK_BUNDLE" skip
fi
# 5. AppImage # 5. AppImage
step "5/5 AppImage (version $VERSION)" step "5/5 AppImage (version $VERSION)"
APPIMAGE=$(ls -1t "$DIST_DIR"/Testium-${VERSION}-*.AppImage 2>/dev/null | head -1)
if [ -z "$APPIMAGE" ]; then
( (
cd "$SCRIPT_DIR/package/appimage" cd "$SCRIPT_DIR/package/appimage"
bash build.sh bash build.sh
@@ -97,6 +151,9 @@ APPIMAGE_SRC=$(ls -1t "$SCRIPT_DIR/package/appimage"/*.AppImage 2>/dev/null | he
APPIMAGE="$DIST_DIR/$(basename "$APPIMAGE_SRC")" APPIMAGE="$DIST_DIR/$(basename "$APPIMAGE_SRC")"
cp -f "$APPIMAGE_SRC" "$APPIMAGE" cp -f "$APPIMAGE_SRC" "$APPIMAGE"
chmod +x "$APPIMAGE" chmod +x "$APPIMAGE"
else
skip
fi
step "All packages built" step "All packages built"
printf " manual : %s\n" "$MANUAL" printf " manual : %s\n" "$MANUAL"

Binary file not shown.

View File

@@ -1 +1 @@
0.1.2 0.1.3