# Flatpak manifest for PDF Editor. # # Build & install (user): # cd packaging/flatpak # python3 gen-pip-sources.py # only after uv.lock changes # flatpak run org.flatpak.Builder --user --install --force-clean \ # build-dir io.github.beleon.pdfed.yml # flatpak run io.github.beleon.pdfed # # PySide6 wheels bundle Qt, so the plain freedesktop runtime suffices. # 25.08, not 24.08: an end-of-life runtime stops receiving security updates, # and this app's whole job is parsing files from other people. # # Flathub derives a repository URL from the app-id: the LAST component is # taken as-is, and only the username component converts dash to underscore, # so io.github.beleon.pdfed resolves to github.com/beleon/pdfed. # https://docs.flathub.org/docs/for-app-authors/requirements # # One repository name is asserted in several places; keep them in step: # - this app-id, and the .desktop / metainfo file names beside it # - the AGPL source offer in licenses/README.md # - the URLs in README.md and the About box (ui/mainwindow.py) # The repository lives at github.com/beleon/pdfed AND codefloe.com/beleon/pdfed, # neither a mirror of the other; the app-id can only encode one of them. app-id: io.github.beleon.pdfed runtime: org.freedesktop.Platform runtime-version: "25.08" sdk: org.freedesktop.Sdk command: pdfed finish-args: - --share=ipc - --socket=wayland - --socket=fallback-x11 - --socket=cups # printing - --device=dri # Full home access: sidecars live next to the PDF, which portal-picked # paths would not allow (the fallback sidecar dir would still work, # but "the file next to your PDF" is the product's promise). # Home alone hid removable media, /mnt and gvfs network mounts -- which is # exactly where a document you have been asked to sign usually lives. - --filesystem=home - --filesystem=/run/media - --filesystem=/media - --filesystem=/mnt - --filesystem=xdg-run/gvfs:ro - --env=PYTHONPATH=/app/lib/python3.13/site-packages # OCR shells out to a host binary the sandbox cannot see; the app detects # this and says so rather than advising an install that cannot help. modules: - python3-deps.json - name: pdfed buildsystem: simple build-options: env: PYTHONPATH: /app/lib/python3.13/site-packages build-commands: - cp -r src/pdfed /app/lib/python3.13/site-packages/ # Stamp the version into the copied package. This build copies the source # tree instead of installing a wheel, so there is no dist-info and # importlib.metadata cannot answer -- `pdfed --version` said "unknown" # and so did every Flatpak bug report. Derived from pyproject.toml here # rather than written by hand anywhere, so it cannot drift; installing a # real wheel would mean shipping the uv_build backend as an extra source # for no other benefit. - python3 -c "import tomllib, pathlib; v = tomllib.load(open('pyproject.toml','rb'))['project']['version']; pathlib.Path('/app/lib/python3.13/site-packages/pdfed/_version.py').write_text('__version__ = %r\n' % v)" - mkdir -p /app/bin # -P is required, not stylistic: `python -c` puts the current directory on # sys.path ahead of PYTHONPATH, so a pdfed/ directory beside the file # being opened would replace the whole application. -sE additionally keep # the user's site-packages and PYTHON* variables out. - printf '#!/bin/sh\nexec python3 -PsE -c "from pdfed import main; main()" "$@"\n' > /app/bin/pdfed - chmod +x /app/bin/pdfed - mkdir -p /app/share/applications /app/share/metainfo - mkdir -p /app/share/icons/hicolor/16x16/apps - python3 -m pdfed.appicon --png /app/share/icons/hicolor/16x16/apps/io.github.beleon.pdfed.png --size 16 - mkdir -p /app/share/icons/hicolor/32x32/apps - python3 -m pdfed.appicon --png /app/share/icons/hicolor/32x32/apps/io.github.beleon.pdfed.png --size 32 - mkdir -p /app/share/icons/hicolor/48x48/apps - python3 -m pdfed.appicon --png /app/share/icons/hicolor/48x48/apps/io.github.beleon.pdfed.png --size 48 - mkdir -p /app/share/icons/hicolor/256x256/apps - python3 -m pdfed.appicon --png /app/share/icons/hicolor/256x256/apps/io.github.beleon.pdfed.png --size 256 - sed -e 's/^Icon=.*/Icon=io.github.beleon.pdfed/' -e 's/^StartupWMClass=.*/StartupWMClass=io.github.beleon.pdfed/' packaging/pdfed.desktop > /app/share/applications/io.github.beleon.pdfed.desktop - cp packaging/flatpak/io.github.beleon.pdfed.metainfo.xml /app/share/metainfo/ - mkdir -p /app/share/doc/pdfed - cp README.md LICENSE src/pdfed/assets/NotoEmoji-OFL.txt /app/share/doc/pdfed/ - cp -r licenses /app/share/doc/pdfed/ sources: - type: dir path: ../..