I'm attempting to learn something of snap desktop packaging by repackaging unity-tweak-tool as a snap. I am finding the docs to be less than stellar, but so far I've got a snapcraft.yaml file that looks like this:

name: unity-tweak-tool
version: 1
summary: configuration tool for the Unity desktop environment
description: |
 Unity Tweak Tool is a settings manager for the Unity desktop.
 It provides users with a fast, simple and easy-to-use interface 
 with which to access many useful and little known features and settings 
 of the desktop environment that one may want to configure.

    command: $SNAP/usr/bin/unity-tweak-tool
    plugs: [unity7]
    plugin: python3
    source: git://github.com/Seth-Johnson/unity-tweak-tool.git
    source-type: git
        - python3-distutils-extra
        - python3-all
        - python3-dbus
        - python-dev
        - gir1.2-glib-2.0
        - gir1.2-gtk-3.0
        - python3-xdg
        - python3-cairo
        - unity-webapps-service  

However when I run snapcraft snap setup.py always fails because several python modules are missing:

  Running setup.py install for unity-tweak-tool ... error
    Complete output from command /home/sethj/projects/snappy-testing/parts/unity-tweak-tool/install/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-s6dwhgys-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xxv1mi7p-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmp2y5izah7:
    ERROR: Python module values not found
    ERROR: Python module apport not found
    ERROR: Python module apport.hookutils not found
    WARNING: syntax errors in notes/wizardry.py: Missing parentheses in call to 'print' (wizardry.py, line 9)
    ERROR: Python module dbus not found
    ERROR: Python module dbus.service not found
    ERROR: Python module dbus.mainloop.glib not found

(full output here)

I admit I'm not 100% sure I doing this properly, but as far as I can tell it should be building the packages listed under build-packages, which satisfy the build requirements for unity-tweak-tool.

Where am I going wrong?

  • Apparently, the problem is the tag --single-version-externally-managed, there is evidence that may be old version of pip, as reported here: github.com/platformio/platformio/issues/279 – eri0o May 30 '16 at 1:33
  • @Elric Oh I see that error now. However I'm more worried about the python modules not being found, at the moment. – Seth May 30 '16 at 1:57

In the case of python you probably want some of those build-packages to be stage-packages. The python plugin sets PYTHONPATH to be within the snap which is why it's missing these packages (you have them installed on the host system instead).

Byt the way, if this upstream had a proper install_requires in setup.py these dependencies would have been taken care automatically for you.

  • Yup, this was my issue. Now that I think about it differently it makes sense that the packages would need to be under stage-packages instead of build-packages. Thanks! – Seth May 30 '16 at 18:05

you can a find an explanation on how to get python to discover the GI repository here

  • Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Thomas Ward Jul 10 '16 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.