Trying to Snap Drawing


#1

Hello!

I was trying to snap Drawing (snapcraft.yaml here) after seeing the post on Omgubuntu.

Unfortunately a lot has changed in the Snapcraft world and I am having a little trouble figuring out things.

I am having the following error when running the snap:

$ eri0o-drawing.drawing 
Traceback (most recent call last):
  File "/snap/eri0o-drawing/x1/usr/bin/drawing", line 36, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'

But I am staging the python-gi package… This package builds with meson instead of having a setup.py.

I noticed the software also includes a deb builder script so maybe it should be used instead and in some way have that deb inside the snap, but I don’t know how to do it either.

(I tried to use a python part, but then I get ModuleNotFoundError: No module named 'distutils.util' right at start when it tries to install pip)

I did found someone on the forums with problems that I am not sure are relevant: Importing PIL and gi into a Snap , unfortunately, no working snapcraft.yaml file.

My system details:

$ lsb_release --all
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic
$ uname -a
Linux 4.15.0-55-generic #60-Ubuntu SMP 
  Tue Jul 2 18:22:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ snapcraft --version
snapcraft, version 3.7.1

#2

FYI @kenvandine and @alexmurray have also worked on this. They are almost done, so you might want to hold off this one so as not to duplicate work.


#3

Ah, ok, I really just wanted to use the software, so I will wait :slight_smile:


#4

@ericoporto2008 I also encountered the same issues but couldn’t solve them either (although I didn’t spend a lot of time trying) - so is good to have @kenvandine on the case - I am leaving it to the expert so will be intriuged to find out how he ends up solving it :smile: The big issue I had was it uses Gtk.Template which is only in newer versions of PyGObject (so the version in python3-gi in bionic is not new enough so just a stage-packages of it is not enough) - this likely needs to be built from source explicitly as a separate part.


#5

Ah, damn, good information. For some reason pip directly instead of the Python packages from the Ubuntu repo gave me errors when using snapcraft (the distutils error above).

About the staging, when I mounted the snap by either installing or as it’s indicated here I do SEE the Python modules there, so it’s some environment thing the reason Python is failing, like it’s using the Python from machine directly or the Python in the snap has the wrong env.

Could you share your snapcraft.yaml even if didn’t worked out?

Hopefully @kenvandine will figure out.


#6

You can find my attempt at https://github.com/alexmurray/drawing-snap - I didn’t end up committing the bits where I experimented with the python plugin to define an extra part for a newer PyGObject so it doesn’t actually work at all as is (well it builds but fails to launch with the same ModuleNotFoundError: No module named 'gi' error as you got - AND if you try launch it directly via /snap/drawing/current/usr/bin/drawing it gets further but fails since python3-gi is not new enough so Gtk.Template doesn’t exist).


#7

Thank you :slight_smile: it’s unfortunate we couldn’t do it. Let’s wait until someone figures this :smile:


#8

This needs enough stuff that’s newer than what’s in bionic that it’s turned into a great test case for the new gnome-3-32-1804 build and content snaps. We found a couple things that we needed to add to the build snap then I’ll be able to finish this snap. Stay tuned!


#9

It’s been uploaded to the store pending manual review


#10

Awesome :slight_smile:

May be interesting to open an issue and let the developer know about it on the GitHub repo and also point to the snapcraft.yaml location for him :wink:

Edit: there’s something really wrong with the store page.


#11

I’ll submit a PR upstream, but not until all the various pieces are in place. Right now you need to manually install the new gnome-3-32-1804 content snap and connect it’s interfaces. That snap should make it to stable in the next couple of weeks.

The store page is a mess, that’s imported from the appstream data in the project. @sergiusens is that a snapcraft bug? For reference the appstream data comes from https://github.com/maoschanz/drawing/blob/master/data/com.github.maoschanz.drawing.appdata.xml.in


Missing desktop file and executable
#12

I also noticed it was amd64 only, this means this not being automated through auto-build , which usually enables other archs.


#13

I’ve filed a snapcraft bug about the appstream data and the store page https://bugs.launchpad.net/snapcraft/+bug/1839197


#14

The PR for that is here: https://github.com/snapcore/snapcraft/pull/2656

If anyone is xml transformations saavy, I would welcome a more complete template being proposed to generate these :slight_smile: