name: frog # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '1.2.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
parts:
frog:
plugin: meson
source-type: git
source: https://github.com/TenderOwl/Frog.git
source-tag: "1.2.0"
meson-parameters:
- --prefix=/usr
- --buildtype=release
# See 'snapcraft plugins'
build-packages:
- meson
- ninja-build
- python3
- python3-gi
- python3-pydbus
- python3-tesserocr
- python3-pyzbar
- tesseract-ocr
- gettext
- pkg-config
- libglib2.0-dev
- desktop-file-utils
- appstream
- libappstream-dev
apps:
frog:
command: desktop-launch /usr/bin/frog
command-chain: [ bin/desktop-launch ]
extensions: [gnome]
environment:
GTK_USE_PORTAL: 1
plugs:
- home
- desktop
- desktop-launch
- XDG_DATA_HOME
plugs:
XDG_DATA_HOME:
interface: personal-files
write:
- $HOME/.local/share
But whenever I run the snapcraft -v I get this…
Cannot pack snap file: Command '['snap', 'pack', '--filename', 'frog_1.2.0_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1. (2023/01/31 08:24:00.104721 container.go:215: in snap "frog": path "desktop-launch" does not exist
error: cannot pack "/root/prime": snap is unusable due to missing files)
Remove the command-chain line from your apps block. This is not needed, as you are only using it to specify the desktop-launch script and that is set automatically to the correct value anyway because you are using the gnome extension.
Edit: oh, and also, change your command to remove desktop-launch as well. It should be like this:
frog
Traceback (most recent call last):
File "/usr/bin/frog", line 59, in <module>
from frog import main
File "/usr/local/lib/python3.10/dist-packages/frog/main.py", line 40, in <module>
from .about_dialog import AboutDialog
File "/usr/local/lib/python3.10/dist-packages/frog/about_dialog.py", line 29, in <module>
from frog.config import APP_ID, RESOURCE_PREFIX
File "/usr/local/lib/python3.10/dist-packages/frog/config.py", line 33, in <module>
if not os.path.exists(os.path.join(os.environ['XDG_DATA_HOME'], 'tessdata')):
File "/usr/lib/python3.10/os.py", line 679, in __getitem__
raise KeyError(key) from None
KeyError: 'XDG_DATA_HOME'
This also happens, when installing via manual compilation
is XDG_DATA_HOME set in your desktop session at all (it would normally be inherited by the snap if it was, i don’t think anything in the desktop-launch script sets it explicitly for the snap) ?
Does running echo $XDG_DATA_HOME in a terminal on your desktop return anything ?
right, if your app has a hard requirement for it and your desktop session does not set it either, you should add an environment: block to your apps: section.
Here it’s. I guess it’s showing, but a wrong directory.
snap run --shell frog
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
soumyaxubuntu@soumyas-GF63-Thin-11UC-866IN:/home/soumyaxubuntu/Downloads/Project/frog$ env | grep XDG
XDG_CONFIG_DIRS=/snap/frog/x1/gnome-platform/etc/xdg:/etc/xdg/xdg-ubuntu:/etc/xdg
XDG_MENU_PREFIX=gnome-
XDG_DATA_HOME=/home/soumyaxubuntu/snap/frog/x1/.local/share
XDG_CONFIG_HOME=/home/soumyaxubuntu/snap/frog/x1/.config
XDG_SESSION_DESKTOP=ubuntu
XDG_SESSION_TYPE=wayland
XDG_CURRENT_DESKTOP=ubuntu:GNOME
XDG_CACHE_HOME=/home/soumyaxubuntu/snap/frog/common/.cache
XDG_SESSION_CLASS=user
XDG_RUNTIME_DIR=/run/user/1000/snap.frog
XDG_DATA_DIRS=/home/soumyaxubuntu/snap/frog/x1/.local/share:/home/soumyaxubuntu/snap/frog/x1:/snap/frog/x1/data-dir:/snap/frog/x1/usr/share:/snap/frog/x1/gnome-platform/usr/share:/usr/share/ubuntu:/home/soumyaxubuntu/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
no, that is the correct directory for a snap …
so you say you are still seeing the KeyError ? that must be an upstream bug with the frog code then since the variable is properly set …
/snap/frog/x3/gnome-platform/command-chain/desktop-launch: /snap/frog/x3/usr/bin/frog: /snap/gnome-42-2204-sdk/current/usr/bin/python3: bad interpreter: No such file or directory
/snap/frog/x3/gnome-platform/command-chain/desktop-launch: line 603: /snap/frog/x3/usr/bin/frog: Success
Almost done… Just some few issues, but help please.