From 2713270e1f6712afe7c50ebe04b2393a58511d27 Mon Sep 17 00:00:00 2001 From: deepend Date: Sun, 22 Feb 2026 10:38:08 -0700 Subject: [PATCH] =?UTF-8?q?Added=20a=20new=20workflow=20step,=20=E2=80=9CB?= =?UTF-8?q?undle=20scripting=20runtimes=20in=20AppDir=E2=80=9D,=20that=20c?= =?UTF-8?q?opies=20Python=20and=20Perl=20runtime=20artifacts=20into=20AppD?= =?UTF-8?q?ir=20(Python=20binary=20+=20stdlib=20+=20libpython3*.so*,=20Per?= =?UTF-8?q?l=20binary=20+=20common=20Perl=20library/share=20paths).=20This?= =?UTF-8?q?=20addresses=20the=20root=20issue=20that=20runner-installed=20r?= =?UTF-8?q?untimes=20were=20not=20necessarily=20ending=20up=20inside=20the?= =?UTF-8?q?=20final=20AppImage=20payload.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated AppRun to explicitly set PYTHONHOME to the bundled runtime root and initialize PYTHONPATH from bundled Python directories, so embedded Python can resolve core modules like encodings at runtime. --- .github/workflows/appimage-build.yml | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/appimage-build.yml b/.github/workflows/appimage-build.yml index 89817109..725cd533 100644 --- a/.github/workflows/appimage-build.yml +++ b/.github/workflows/appimage-build.yml @@ -61,6 +61,39 @@ jobs: rm -rf AppDir DESTDIR="${PWD}/AppDir" ninja -C build install + - name: Bundle scripting runtimes in AppDir + run: | + set -eux + + python3_version="$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" + + install -Dm755 "$(command -v python3)" "AppDir/usr/bin/python3" + if [ -x "/usr/bin/perl" ]; then + install -Dm755 /usr/bin/perl AppDir/usr/bin/perl + fi + + install -d AppDir/usr/lib + cp -a "/usr/lib/python${python3_version}" "AppDir/usr/lib/" + + if [ -d "/usr/lib/x86_64-linux-gnu/perl" ]; then + install -d AppDir/usr/lib/x86_64-linux-gnu + cp -a /usr/lib/x86_64-linux-gnu/perl AppDir/usr/lib/x86_64-linux-gnu/ + fi + + if [ -d "/usr/share/perl" ]; then + install -d AppDir/usr/share + cp -a /usr/share/perl AppDir/usr/share/ + fi + + if [ -d "/usr/share/perl5" ]; then + install -d AppDir/usr/share + cp -a /usr/share/perl5 AppDir/usr/share/ + fi + if compgen -G '/usr/lib/x86_64-linux-gnu/libpython3*.so*' > /dev/null; then + install -d AppDir/usr/lib/x86_64-linux-gnu + cp -a /usr/lib/x86_64-linux-gnu/libpython3*.so* AppDir/usr/lib/x86_64-linux-gnu/ + fi + - name: Verify bundled plugins run: | set -eux @@ -118,6 +151,14 @@ jobs: export GIO_EXTRA_MODULES="$APPDIR/usr/lib/gio/modules${GIO_EXTRA_MODULES:+:$GIO_EXTRA_MODULES}" fi + export PYTHONHOME="$APPDIR/usr" + python_stdlib_dir="$(find "$APPDIR/usr/lib" -maxdepth 1 -type d -name 'python3.*' | head -n 1 || true)" + if [ -n "$python_stdlib_dir" ] && [ -d "$python_stdlib_dir/dist-packages" ]; then + export PYTHONPATH="$python_stdlib_dir/dist-packages:$APPDIR/usr/lib/python3/dist-packages${PYTHONPATH:+:$PYTHONPATH}" + else + export PYTHONPATH="$APPDIR/usr/lib/python3/dist-packages${PYTHONPATH:+:$PYTHONPATH}" + fi + # OpenSSL trust store override export SSL_CERT_FILE="${SSL_CERT_FILE:-$APPDIR/etc/ssl/certs/ca-certificates.crt}" export SSL_CERT_DIR="${SSL_CERT_DIR:-$APPDIR/etc/ssl/certs}"