Fix read-only /app failure + add app icon

On first launch O3DE pip-installs its 'o3de' CLI with 'pip install -e'
(editable), which writes an egg-info next to the source under read-only
/app and fails ([Errno 30] Read-only file system), leaving the venv broken
("unable to install O3DE's built-in Python").

- Patch cmake/LYPython.cmake at build time to force a normal (non-editable)
  install, which builds in a temp dir and lands in the writable ~/.o3de venv.
- Drop the build-time get_python "bake": the venv is per-user (keyed to
  $HOME), so it can only be created at runtime; baking under a throwaway
  build HOME did nothing. Speeds up CI; removes cmake/python3 build deps and
  the network build-arg.
- Add a real launcher icon (org.o3de.O3DE.png).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 12:02:41 +02:00
parent 759c49bbeb
commit f4d2dddd02
5 changed files with 41 additions and 39 deletions
+13 -8
View File
@@ -29,21 +29,26 @@ tar -C data -xf data.tar.*
mkdir -p "$DEST/opt"
cp -a data/opt/. "$DEST/opt/"
echo ">> baking O3DE's Python runtime into the image"
# O3DE fetches Python into its install tree on first use, but that tree is
# read-only at runtime in a Flatpak, so populate it now while it is writable.
ENGINE_DIR=$(find "$DEST/opt/O3DE" -mindepth 1 -maxdepth 1 -type d | head -n1)
echo " engine dir: $ENGINE_DIR"
if [ -x "$ENGINE_DIR/python/get_python.sh" ]; then
( cd "$ENGINE_DIR" && HOME="$PWD" ./python/get_python.sh )
echo ">> patching the editable pip install (read-only /app workaround)"
# On first launch O3DE sets up a per-user Python venv in ~/.o3de and pip-installs
# its 'o3de' CLI with 'pip install -e' (editable). Editable mode writes an
# egg-info next to the source under /app, which is read-only in a Flatpak, so it
# fails. Force a normal (non-editable) install instead: pip builds in a temp dir
# and installs into the writable ~/.o3de venv. (Nothing Python-related needs to
# be baked into the image; it all lives per-user under ~/.o3de.)
LYPYTHON=$(find "$DEST/opt/O3DE" -path '*/cmake/LYPython.cmake' | head -n1)
if [ -n "$LYPYTHON" ] && grep -q 'set(_pip_install_mode_args "-e")' "$LYPYTHON"; then
sed -i 's/set(_pip_install_mode_args "-e")/set(_pip_install_mode_args "")/' "$LYPYTHON"
echo " patched: $LYPYTHON"
else
echo " WARNING: get_python.sh not found; Python may fail at runtime" >&2
echo " WARNING: editable-install line not found in LYPython.cmake; O3DE layout may have changed" >&2
fi
echo ">> installing launcher + metadata"
install -Dm755 o3de-wrapper.sh "$DEST/bin/o3de-wrapper.sh"
install -Dm644 org.o3de.O3DE.desktop "$DEST/share/applications/$APP_ID.desktop"
install -Dm644 org.o3de.O3DE.metainfo.xml "$DEST/share/metainfo/$APP_ID.metainfo.xml"
install -Dm644 org.o3de.O3DE.png "$DEST/share/icons/hicolor/256x256/apps/$APP_ID.png"
echo ">> build-finish (command + sandbox permissions)"
flatpak build-finish build-dir \