Hi everyone, I’m new to snap and trying to learn the ins and outs by packaging a simple python gtk application but falling short and seeking some help.
My application has the following files:
root@01df2af057f9:/gtk-desktop-example# tree . ├── build-aux │ └── meson │ └── postinstall.py ├── com.github.kenvandine.gtk-desktop-example.json ├── COPYING ├── data │ ├── com.github.kenvandine.gtk-desktop-example.appdata.xml.in │ ├── com.github.kenvandine.gtk-desktop-example.desktop.in │ ├── com.github.kenvandine.gtk-desktop-example.gschema.xml │ └── meson.build ├── meson.build ├── po │ ├── LINGUAS │ ├── meson.build │ └── POTFILES ├── snap │ └── snapcraft.yaml └── src ├── gtk-desktop-example.in ├── __init__.py ├── main.py └── meson.build
The current issue is that I can build the snap, and install it, but there must be something wrong with how I’m building it because 1) the desktop icon doesn’t show up in the list of installed applications and 2) when I run the app from the cli, it doesn’t launch and instead complains that the executable doesn’t exist:
$ gtk-desktop-example /snap/gtk-desktop-example/x1/bin/desktop-launch: line 573: /snap/gtk-desktop-example/x1/bin/gtk-desktop-example: No such file or directory
Another thing that is perhaps worth noting, is that when the snap is building (in docker), the build output mentions a slew of needed “libraries that are not included in the snap or base” and I’m not sure how to get rid of this besides explicitly staging packages like libc6 (which the documentation on staging packages to satisfy missing libraries recommends against). Perhaps I’m hitting this bug.
Here is my snapcraft.yaml file:
name: gtk-desktop-example base: core18 version: '0.1' summary: What theme am I using? description: | A python gtk application that lists what theme is being used. grade: devel # must be 'stable' to release into candidate/stable channels confinement: devmode # use 'strict' once you have the right plugs and slots # seems reasonable, taken from mailspring example: https://github.com/Foundry376/Mailspring/blob/master/snap/snapcraft.template.yaml plugs: gtk-3-themes: interface: content target: $SNAP/share/themes default-provider: gtk-common-themes:gtk-3-themes icon-themes: interface: content target: $SNAP/share/icons default-provider: gtk-common-themes:icon-themes apps: gtk-desktop-example: command: desktop-launch $SNAP/bin/gtk-desktop-example plugs: - desktop - desktop-legacy - wayland - unity7 - gsettings - x11 parts: gtk-desktop-example: after: [desktop-gtk3] plugin: meson source: . # critical for desktop-launch command to be available: https://forum.snapcraft.io/t/snapcraft-3-core18-and-desktop-apps/9520/2 desktop-gtk3: build-packages: - build-essential - libgtk-3-dev make-parameters: - FLAVOR=gtk3 plugin: make source: https://github.com/ubuntu/snapcraft-desktop-helpers.git source-subdir: gtk stage-packages: - libxkbcommon0 - ttf-ubuntu-font-family - dmz-cursor-theme - light-themes - adwaita-icon-theme - gnome-themes-standard - shared-mime-info - libgtk-3-0 - libgdk-pixbuf2.0-0 - libglib2.0-bin - libgtk-3-bin - unity-gtk3-module - libappindicator3-1 - locales-all - xdg-user-dirs - ibus-gtk3 - libibus-1.0-5 - fcitx-frontend-gtk3
Any advice would be really helpful