Merge lp:~3v1n0/snappy-playpen/hello-unity-fixes into lp:snappy-playpen

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Michael Hall
Approved revision: 52
Merged at revision: 48
Proposed branch: lp:~3v1n0/snappy-playpen/hello-unity-fixes
Merge into: lp:snappy-playpen
Diff against target: 523 lines
To merge this branch: bzr merge lp:~3v1n0/snappy-playpen/hello-unity-fixes
Reviewer Review Type Date Requested Status
Michael Hall (community) Approve
Review via email: mp+294858@code.launchpad.net

Description of the change

Fixed hello-unity, to properly build and run in snap environment.

Since the upstream code needs some patches, I've played a little with it including an example of "quilt" plugin, which allows to use quilt patches to fix upstream code (upstream fixes parially live at lp:~3v1n0/hello-unity/sandbox-support).

To post a comment you must log in.
51. By Marco Trevisan (Treviño)

HelloUnity: use cached files and user data around

52. By Marco Trevisan (Treviño)

HelloUnity: use snap version to chose which data or cache path use

Revision history for this message
Michael Hall (mhall119) wrote :

Built a snap using this, but got apparmor error when running it:

May 16 23:00:34 mhall-thinkpad kernel: [10792.749388] audit: type=1400 audit(1463457634.502:103): apparmor="DENIED" operation="open" profile="snap.hello-unity.hello-unity" name="/home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/stage/usr/lib/python2.7/os.py" pid=18146 comm="hello-unity" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
May 16 23:00:34 mhall-thinkpad kernel: [10792.749452] audit: type=1400 audit(1463457634.502:104): apparmor="DENIED" operation="open" profile="snap.hello-unity.hello-unity" name="/home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/stage/usr/lib/python2.7/os.pyc" pid=18146 comm="hello-unity" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

Revision history for this message
Michael Hall (mhall119) wrote :

Even installing with --devmode running the app fails:

mhall@mhall-thinkpad:~/projects/Ubuntu/snaps/snappy-playpen/hello-unity$ /snap/bin/hello-unity
Traceback (most recent call last):
  File "/snap/hello-unity/100001/usr/bin/hello-unity", line 4, in <module>
    __import__('pkg_resources').run_script('hello-unity==0.4', 'hello-unity')
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1496, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'hello-unity'

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Mhmhmh.... Wait, are you sure you installed this snap version? Because this should run /snap/hello-unity/current/opt/bin/hello-unity which is not using the run_script thing.

I also had this problem, but also desktop files should actually run
  /snap/hello-unity/current/bin/hello-unity

Which is a wrapper that eventually calls the script above

Revision history for this message
Michael Hall (mhall119) wrote :

I removed and rebuilt everything, installed with --devmode, still getting this:

mhall@mhall-thinkpad:~/projects/Ubuntu/snaps$ hello-unity
Traceback (most recent call last):
  File "/snap/hello-unity/100001/usr/bin/hello-unity", line 4, in <module>
    __import__('pkg_resources').run_script('hello-unity==0.4', 'hello-unity')
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1496, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'hello-unity'

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I get a different result. Note, I 'snap remove hello-unity' and then 'snap install ./hello-unity_0.4-snap2_amd64.snap'.

Note I didn't install it with --devmode. When I run it I see:

Traceback (most recent call last):
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/site.py", line 75, in <module>
    __boot()
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/site.py", line 3, in __boot
    import os
ImportError: No module named os

and the following apparmor denials:
audit: type=1400 audit(1463513788.872:142): apparmor="DENIED" operation="open" profile="snap.hello-unity.hello-unity" name="/home/jamie/bzr-pulls/snappy-playpen/hello-unity/stage/usr/lib/python2.7/os.py" pid=31432 comm="hello-unity" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
audit: type=1400 audit(1463513788.872:143): apparmor="DENIED" operation="open" profile="snap.hello-unity.hello-unity" name="/home/jamie/bzr-pulls/snappy-playpen/hello-unity/stage/usr/lib/python2.7/os.pyc" pid=31432 comm="hello-unity" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

If I do:
$ grep -r 'jamie/bzr-pulls' ./*|grep -v pyc

I see a ton of absolute paths to my snap build directory rather then the snap install directory (/snap/hello-unity/current/).

Revision history for this message
Michael Hall (mhall119) wrote :

My mistake, I messed up my bzr merge and that was causing all of the problems. I had to use --devmode, and amd also getting some apparmor denials,but the app runs and most of the Unity API use works too, approving

review: Approve
Revision history for this message
Michael Hall (mhall119) wrote :

Marco, can you propose these patches to the upstream project so I can merge them there?

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Michael, sure... Changes are already in lp:~3v1n0/hello-unity/sandbox-support (I planned to get these merged upstream too), but I also wanted to use this example to show how to patch upstream code.

However, we still need to include a patch (the one that changes the name of the .desktop file), so You could still merge it and update the downstream patches accordingly (remove the first two of the serie).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hello-unity/hello-unity.wrapper' (properties changed: +x to -x)
2--- hello-unity/hello-unity.wrapper 2016-04-09 02:39:30 +0000
3+++ hello-unity/hello-unity.wrapper 2016-05-17 01:04:22 +0000
4@@ -1,6 +1,12 @@
5-#!/bin/sh
6+#!/bin/bash
7
8-ARCH='i386-linux-gnu'
9+if [ "$SNAP_ARCH" == "amd64" ]; then
10+ ARCH='x86_64-linux-gnu'
11+elif [ "$SNAP_ARCH" == "armhf" ]; then
12+ ARCH="arm-linux-gnueabihf"
13+else
14+ ARCH="$SNAP_ARCH-linux-gnu"
15+fi
16
17 export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH
18
19@@ -12,16 +18,12 @@
20 export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa-egl:$LD_LIBRARY_PATH
21
22 # XDG Config
23-export XDG_CONFIG_DIRS=$SNAP/etc/xdg:$XDG_CONFIG_DIRS
24-export XDG_CONFIG_DIRS=$SNAP/usr/xdg:$XDG_CONFIG_DIRS
25+export XDG_CONFIG_DIRS=$SNAP/etc:$XDG_CONFIG_DIRS
26+
27 # Note: this doesn't seem to work, QML's LocalStorage either ignores
28 # or fails to use $SNAP_USER_DATA if defined here
29-export XDG_DATA_DIRS=$SNAP_USER_DATA:$XDG_DATA_DIRS
30 export XDG_DATA_DIRS=$SNAP/usr/share:$XDG_DATA_DIRS
31
32-# Not good, needed for fontconfig
33-export XDG_DATA_HOME=$SNAP/usr/share
34-
35 # Font Config
36 export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d
37 export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf
38@@ -32,5 +34,76 @@
39 # Necessary for the SDK to find the translations directory
40 export APP_DIR=$SNAP
41
42-cd $SNAP
43-usr/bin/python $SNAP/usr/bin/hello-unity
44+# Set XDG_DATA_HOME to local path, dependent on snap version
45+export XDG_DATA_HOME=$SNAP_USER_DATA/.local-$SNAP_VERSION/share
46+export XDG_DATA_DIRS=$XDG_DATA_HOME:$XDG_DATA_DIRS
47+mkdir -p $XDG_DATA_HOME
48+
49+# Set cache folder to local path, dependent on snap version
50+export XDG_CACHE_HOME=$SNAP_USER_DATA/.cache-$SNAP_VERSION
51+mkdir -p $XDG_CACHE_HOME
52+
53+# Setup GI Repository typelibs (needed as some packages doesn't support multiarch)
54+export GI_TYPELIB_PATH=$SNAP/usr/lib/$ARCH/girepository-1.0:$SNAP/usr/lib/girepository-1.0
55+
56+# Not good, needed for fontconfig and themes
57+ln -sf $SNAP/usr/share/{fontconfig,fonts,fonts-*,themes} $XDG_DATA_HOME
58+
59+# Gio modules and cache
60+export GIO_MODULE_DIR=$XDG_CACHE_HOME/gio-modules
61+
62+if [ ! -d $GIO_MODULE_DIR ]; then
63+ mkdir -p $GIO_MODULE_DIR
64+ ln -s $SNAP/usr/lib/$ARCH/gio/modules/*.so $GIO_MODULE_DIR
65+ $SNAP/usr/lib/$ARCH/glib-2.0/gio-querymodules $GIO_MODULE_DIR
66+fi
67+
68+# Build mime.cache
69+if [ ! -d $XDG_DATA_HOME/mime ]; then
70+ cp -a $SNAP/usr/share/mime $XDG_DATA_HOME
71+ update-mime-database $XDG_DATA_HOME/mime
72+fi
73+
74+# Setup GDK pixbuf loaders
75+export GDK_PIXBUF_MODULE_FILE=$XDG_CACHE_HOME/gdk-pixbuf-loaders.cache
76+export GDK_PIXBUF_MODULEDIR=$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders
77+
78+if [ ! -e $GDK_PIXBUF_MODULE_FILE ]; then
79+ $SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders > $GDK_PIXBUF_MODULE_FILE
80+fi
81+
82+# Keep an array of data dirs, for looping through them
83+IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS"
84+
85+# Setup compiled gsettings schema
86+GS_SCHEMA_DIR=$XDG_DATA_HOME/glib-2.0/schemas
87+
88+if [ ! -d $GS_SCHEMA_DIR ]; then
89+ mkdir -p $GS_SCHEMA_DIR
90+ for d in "${data_dirs_array[@]}"; do
91+ ln -s $d/glib-2.0/schemas/*.xml $GS_SCHEMA_DIR
92+ done
93+
94+ $SNAP/usr/lib/$ARCH/glib-2.0/glib-compile-schemas $GS_SCHEMA_DIR
95+fi
96+
97+# Icon themes cache
98+if [ ! -d $XDG_DATA_HOME/icons ]; then
99+ mkdir -p $XDG_DATA_HOME/icons
100+ for d in "${data_dirs_array[@]}"; do
101+ for i in $d/icons/*; do
102+ if [ -d "$i" ]; then
103+ theme_dir=$XDG_DATA_HOME/icons/$(basename "$i")
104+ mkdir -p "$theme_dir"
105+ ln -s $i/* "$theme_dir"
106+ $SNAP/usr/sbin/update-icon-caches "$theme_dir"
107+ gtk-update-icon-cache-3.0 "$theme_dir"
108+ fi
109+ done
110+ done
111+fi
112+
113+# GTK modules
114+export GTK_PATH=$SNAP/usr/lib/$ARCH/gtk-3.0
115+
116+exec $SNAP/usr/bin/python $SNAP/opt/bin/hello-unity
117
118=== added directory 'hello-unity/parts'
119=== added directory 'hello-unity/parts/plugins'
120=== added file 'hello-unity/parts/plugins/x-quilt.py'
121--- hello-unity/parts/plugins/x-quilt.py 1970-01-01 00:00:00 +0000
122+++ hello-unity/parts/plugins/x-quilt.py 2016-05-17 01:04:22 +0000
123@@ -0,0 +1,106 @@
124+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
125+#
126+# Author: Marco Trevisan <marco.trevisan@canonical.com>
127+# Copyright (C) 2016 Canonical Ltd
128+#
129+# This program is free software: you can redistribute it and/or modify
130+# it under the terms of the GNU General Public License version 3 as
131+# published by the Free Software Foundation.
132+#
133+# This program is distributed in the hope that it will be useful,
134+# but WITHOUT ANY WARRANTY; without even the implied warranty of
135+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
136+# GNU General Public License for more details.
137+#
138+# You should have received a copy of the GNU General Public License
139+# along with this program. If not, see <http://www.gnu.org/licenses/>.
140+
141+"""A simple snapcraft plugin that allows to use quilt patches with any
142+source package.
143+
144+In order to use this, the yaml file should contain:
145+ - A part that only fetches the sources (you can use the copy plugin or
146+ a dummy project plugin, that only extends BasePlugin)
147+ - A part that uses this plugin (quilt) and that has the `after:` and
148+ `target-part:` parameters containing the part defined above
149+ - A part that uses the actual builder plugin for such sources, that has
150+ the previous part (patches) in the `after:` list, and that uses as
151+ `sources:` the sources part.
152+
153+For example:
154+
155+ parts:
156+ upstream-src:
157+ plugin: copy
158+ source: https://github.com/ubuntu-core/snapcraft.git
159+ files:
160+ README.md: docs/README.md
161+
162+ patches:
163+ plugin: quilt
164+ source: https://github.com/3v1n0/my-snapcraft-patches.git
165+ target-part: upstream-src
166+ after: [upstream-src]
167+
168+ setup:
169+ plugin: python3
170+ source: ./parts/upstream-src/src/
171+ build-packages:
172+ - python-distutils-extra
173+ after: [patches]
174+"""
175+
176+import os
177+import stat
178+
179+import snapcraft
180+
181+class QuiltPlugin(snapcraft.BasePlugin):
182+
183+ @classmethod
184+ def schema(cls):
185+ schema = super().schema()
186+
187+ schema['properties']['patches-dir'] = {
188+ 'type': 'string',
189+ 'default': '',
190+ }
191+
192+ schema['properties']['target-part'] = {
193+ 'type': 'string'
194+ }
195+
196+ schema['required'].append('target-part')
197+
198+ return schema
199+
200+ def __init__(self, name, options, project):
201+ super().__init__(name, options, project)
202+ self.build_packages.extend(['quilt'])
203+
204+ self.patch_dir = os.path.join(self.sourcedir, self.options.patches_dir)
205+ self.target_dir = os.path.join(self.project.parts_dir, self.options.target_part)
206+ self.target_src = os.path.join(self.target_dir, "src")
207+
208+ def build(self):
209+ super().build()
210+
211+ if not os.path.exists(self.target_src) or \
212+ not os.path.exists(os.path.join(self.target_dir, "state", "pull")):
213+ raise EnvironmentError('Target part not fetched, fix order in yaml file: {}'.format(self.options.target_part))
214+
215+ if os.path.exists(self.patch_dir):
216+ os.environ['QUILT_PATCHES'] = self.patch_dir
217+ self.run(['quilt', 'push', '-a'], cwd=self.target_src)
218+
219+ def clean_build(self):
220+ super().clean_build()
221+
222+ if os.path.exists(self.patch_dir) and \
223+ os.path.exists(os.path.join(self.partdir, "state", "build")):
224+ try:
225+ os.environ['QUILT_PATCHES'] = self.patch_dir
226+ self.run(['quilt', 'pop', '-a', '-f'], cwd=self.target_src)
227+ except:
228+ pass
229+
230
231=== added directory 'hello-unity/patches'
232=== added file 'hello-unity/patches/ignore-sound-tab-if-missing-indicator.patch'
233--- hello-unity/patches/ignore-sound-tab-if-missing-indicator.patch 1970-01-01 00:00:00 +0000
234+++ hello-unity/patches/ignore-sound-tab-if-missing-indicator.patch 2016-05-17 01:04:22 +0000
235@@ -0,0 +1,22 @@
236+Index: hello-unity-snapped/hello_unity/window.py
237+===================================================================
238+--- hello-unity-snapped.orig/hello_unity/window.py
239++++ hello-unity-snapped/hello_unity/window.py
240+@@ -3,6 +3,7 @@
241+ from gettext import gettext as _
242+
243+ from gi.repository import Gdk
244++from gi.repository import Gio
245+ from gi.repository import Gtk
246+ from gi.repository import GtkSource
247+
248+@@ -53,7 +54,8 @@ application can integrate with Ubuntu Un
249+ self.add_section(_("Launcher"), HelloLauncher(self))
250+ self.add_section(_("Indicator"), HelloIndicator(self))
251+ self.add_section(_("Message Menu"), HelloMessageMenu(self))
252+- self.add_section(_("Sound Menu"), HelloSoundMenu(self))
253++ if Gio.SettingsSchemaSource.get_default().lookup('com.canonical.indicator.sound', False):
254++ self.add_section(_("Sound Menu"), HelloSoundMenu(self))
255+ #self.add_section(_("Dash"), hello_unity.HelloUnitySection(self))
256+ self.add_section(_("Notifications"), HelloNotifications(self))
257+
258
259=== added file 'hello-unity/patches/series'
260--- hello-unity/patches/series 1970-01-01 00:00:00 +0000
261+++ hello-unity/patches/series 2016-05-17 01:04:22 +0000
262@@ -0,0 +1,3 @@
263+use-xdg-dirs-to-get-file-paths.patch
264+ignore-sound-tab-if-missing-indicator.patch
265+use-snappy-desktop-id.patch
266
267=== added file 'hello-unity/patches/use-snappy-desktop-id.patch'
268--- hello-unity/patches/use-snappy-desktop-id.patch 1970-01-01 00:00:00 +0000
269+++ hello-unity/patches/use-snappy-desktop-id.patch 2016-05-17 01:04:22 +0000
270@@ -0,0 +1,39 @@
271+Index: hello-unity-snapped/hello_unity/launcher.py
272+===================================================================
273+--- hello-unity-snapped.orig/hello_unity/launcher.py
274++++ hello-unity-snapped/hello_unity/launcher.py
275+@@ -34,7 +34,7 @@ class HelloLauncher(hello_unity.HelloUni
276+
277+ # Get a reference to the launcher for this application. The .desktop
278+ # file give Unity information about the Application's name and icon
279+- self.launcher = Unity.LauncherEntry.get_for_desktop_id("hello-unity.desktop")
280++ self.launcher = Unity.LauncherEntry.get_for_desktop_id("hello-unity_hello-unity.desktop")
281+
282+ # Create the quicklist menu
283+ quicklist = Dbusmenu.Menuitem.new()
284+Index: hello-unity-snapped/hello_unity/messagemenu.py
285+===================================================================
286+--- hello-unity-snapped.orig/hello_unity/messagemenu.py
287++++ hello-unity-snapped/hello_unity/messagemenu.py
288+@@ -28,7 +28,7 @@ class HelloMessageMenu(hello_unity.Hello
289+ def __init__(self, window):
290+
291+ # Create an "app" to represent the Hello Unity application
292+- self.app = MessagingMenu.App.new("hello-unity.desktop")
293++ self.app = MessagingMenu.App.new("hello-unity_hello-unity.desktop")
294+ self.app.connect("activate-source", self.remove_indication)
295+
296+ # Register this app with the messaging menu
297+Index: hello-unity-snapped/hello_unity/soundmenu.py
298+===================================================================
299+--- hello-unity-snapped.orig/hello_unity/soundmenu.py
300++++ hello-unity-snapped/hello_unity/soundmenu.py
301+@@ -41,7 +41,7 @@ class HelloSoundMenu(hello_unity.HelloUn
302+ self.sound_menu_settings.set_strv('blacklisted-media-players', [p for p in self.blacklisted_players if p != 'hello-unity'])
303+
304+ # Create a hello-unity music player instance
305+- self.player = Unity.MusicPlayer.new('hello-unity.desktop')
306++ self.player = Unity.MusicPlayer.new('hello-unity_hello-unity.desktop')
307+ self.player.props.title = _('Hello Unity')
308+
309+ # What to do when the user presses the indicator buttons
310
311=== added file 'hello-unity/patches/use-xdg-dirs-to-get-file-paths.patch'
312--- hello-unity/patches/use-xdg-dirs-to-get-file-paths.patch 1970-01-01 00:00:00 +0000
313+++ hello-unity/patches/use-xdg-dirs-to-get-file-paths.patch 2016-05-17 01:04:22 +0000
314@@ -0,0 +1,78 @@
315+Index: hello-unity-snapped/hello_unity/__init__.py
316+===================================================================
317+--- hello-unity-snapped.orig/hello_unity/__init__.py
318++++ hello-unity-snapped/hello_unity/__init__.py
319+@@ -1,10 +1,20 @@
320+ import os
321+ from gi.repository import Gtk
322++from xdg.BaseDirectory import xdg_data_dirs
323+
324+ COLOR_ICON_PATH = 'hello-unity'
325+ MONO_ICON_PATH = 'hello-unity-mono-dark'
326+ ATTENTION_ICON_PATH = 'hello-unity-attention'
327+
328++def get_icon_path(basename):
329++ for dir in xdg_data_dirs:
330++ path = '%s/pixmaps/%s.svg' % (dir, basename)
331++ icon = Gtk.Image.new_from_file(path)
332++ pixbuf = icon.get_pixbuf()
333++ if pixbuf:
334++ return path
335++
336++
337+ class HelloUnitySection(object):
338+
339+ def get_controls(self):
340+Index: hello-unity-snapped/hello_unity/soundmenu.py
341+===================================================================
342+--- hello-unity-snapped.orig/hello_unity/soundmenu.py
343++++ hello-unity-snapped/hello_unity/soundmenu.py
344+@@ -2,6 +2,7 @@
345+
346+ # Used for making text translatable
347+ from gettext import gettext as _
348++from xdg.BaseDirectory import xdg_data_dirs
349+
350+ # Import the base UI toolkit modules
351+ from gi.repository import Gdk
352+@@ -201,7 +202,9 @@ class HelloSoundMenu(hello_unity.HelloUn
353+ data.props.album = "Unity Showcase"
354+
355+ # You can also set the cover art for this track
356+- data.props.art_location = Gio.File.new_for_path('/usr/share/pixmaps/%s.svg' % hello_unity.ATTENTION_ICON_PATH)
357++ attention_icon = hello_unity.get_icon_path(hello_unity.ATTENTION_ICON_PATH)
358++ if attention_icon:
359++ data.props.art_location = Gio.File.new_for_path(attention_icon)
360+
361+ # Set the new track metadata as the current track in the sound menu
362+ self.player.props.current_track = data
363+Index: hello-unity-snapped/hello_unity/window.py
364+===================================================================
365+--- hello-unity-snapped.orig/hello_unity/window.py
366++++ hello-unity-snapped/hello_unity/window.py
367+@@ -19,14 +19,21 @@ class HelloWindow(Gtk.Window):
368+ Gtk.Window.__init__(self, title=_("Hello Unity"))
369+
370+ self.set_default_size(500, 500)
371+- self.color_icon = Gtk.Image.new_from_file('/usr/share/pixmaps/%s.svg' % hello_unity.COLOR_ICON_PATH)
372+-
373+- self.set_icon(self.color_icon.get_pixbuf())
374++
375++ icon_path = hello_unity.get_icon_path(hello_unity.COLOR_ICON_PATH)
376++
377++ if icon_path:
378++ color_icon = Gtk.Image.new_from_file(icon_path)
379++ pixbuf = color_icon.get_pixbuf()
380++ self.set_icon(pixbuf)
381+
382+ self.content = Gtk.VBox()
383+
384+ self.header = Gtk.HBox()
385+- self.header.pack_start(Gtk.Image.new_from_pixbuf(self.color_icon.get_pixbuf().scale_simple(64, 64, 0)), False, False, 10)
386++ if icon_path:
387++ img = Gtk.Image.new_from_pixbuf(pixbuf.scale_simple(64, 64, 0))
388++ self.header.pack_start(img, False, False, 10)
389++
390+ intro = Gtk.Label()
391+ intro.set_markup(_('''
392+ <b>Hello Unity!</b>
393
394=== added directory 'hello-unity/setup'
395=== added directory 'hello-unity/setup/gui'
396=== added file 'hello-unity/setup/gui/hello-unity.desktop'
397--- hello-unity/setup/gui/hello-unity.desktop 1970-01-01 00:00:00 +0000
398+++ hello-unity/setup/gui/hello-unity.desktop 2016-05-17 01:04:22 +0000
399@@ -0,0 +1,10 @@
400+[Desktop Entry]
401+Name=HelloUnity
402+X-GNOME-FullName=Hello Unity
403+Comment=Unity Integration Showcase
404+Categories=GNOME;Utility;
405+Exec=hello-unity
406+Icon=${SNAP}/usr/share/pixmaps/hello-unity.svg
407+Terminal=false
408+Type=Application
409+Version=0.4
410
411=== removed file 'hello-unity/snapcraft.log'
412--- hello-unity/snapcraft.log 2016-04-09 02:39:30 +0000
413+++ hello-unity/snapcraft.log 1970-01-01 00:00:00 +0000
414@@ -1,40 +0,0 @@
415-Preparing to pull hello-unity
416-
417Hit http://us.archive.ubuntu.com/ubuntu xenial InRelease
418-
419Hit http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease
420-
421Hit http://security.ubuntu.com/ubuntu xenial-security InRelease
422-
423Fetched 0 B in 0s (0 B/s)
424-Skipping blacklisted from manifest packages: ['adduser', 'apt', 'apt-utils', 'base-files', 'base-passwd', 'bash', 'bsdutils', 'coreutils', 'dash', 'debconf', 'debconf-i18n', 'debianutils', 'diffutils', 'dmsetup', 'dpkg', 'e2fslibs', 'e2fsprogs', 'file', 'findutils', 'gcc-4.9-base', 'gcc-5-base', 'gnupg', 'gpgv', 'grep', 'gzip', 'hostname', 'init', 'initscripts', 'insserv', 'libacl1', 'libapparmor1', 'libattr1', 'libaudit-common', 'libaudit1', 'libblkid1', 'libbz2-1.0', 'libc-bin', 'libc6', 'libcap2', 'libcap2-bin', 'libcomerr2', 'libcryptsetup4', 'libdb5.3', 'libdebconfclient0', 'libdevmapper1.02.1', 'libgcc1', 'libgcrypt20', 'libgpg-error0', 'libgpm2', 'libkmod2', 'liblocale-gettext-perl', 'liblzma5', 'libmagic1', 'libmount1', 'libncurses5', 'libncursesw5', 'libpam-modules', 'libpam-modules-bin', 'libpam-runtime', 'libpam0g', 'libpcre3', 'libreadline6', 'libselinux1', 'libsemanage-common', 'libsemanage1', 'libsepol1', 'libslang2', 'libsmartcols1', 'libss2', 'libstdc++6', 'libsystemd0', 'libtext-charwidth-perl', 'libtext-iconv-perl', 'libtext-wrapi18n-perl', 'libtinfo5', 'libudev1', 'libusb-0.1-4', 'libustr-1.0-1', 'libuuid1', 'locales', 'login', 'lsb-base', 'makedev', 'manpages', 'manpages-dev', 'mawk', 'mount', 'multiarch-support', 'ncurses-base', 'ncurses-bin', 'passwd', 'perl-base', 'procps', 'readline-common', 'sed', 'sensible-utils', 'systemd', 'systemd-sysv', 'sysv-rc', 'sysvinit-utils', 'tar', 'tzdata', 'ubuntu-keyring', 'udev', 'util-linux', 'zlib1g']
425-
426Fetched 0 B in 0s (0 B/s)
427-Pulling hello-unity
428-No revisions or tags to pull.
429-python2 /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/bin/easy_install --prefix /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr pip
430-Searching for pip
431-Best match: pip 8.1.1
432-Processing pip-8.1.1-py2.7.egg
433-pip 8.1.1 is already the active version in easy-install.pth
434-Installing pip script to /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/bin
435-Installing pip2.7 script to /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/bin
436-Installing pip2 script to /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/bin
437-
438-Using /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg
439-Processing dependencies for pip
440-Finished processing dependencies for pip
441-python2 /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/bin/pip2 install --global-option=build_ext --global-option=-I/home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/include/python2.7 --target /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/lib/python2.7/site-packages .
442-Processing /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/src
443-Installing collected packages: hello-unity
444- Running setup.py install for hello-unity: started
445- Running setup.py install for hello-unity: finished with status 'error'
446- Complete output from command /home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-WmPupa-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" build_ext -I/home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/parts/hello-unity/install/usr/include/python2.7 install --record /tmp/pip-GIIwsc-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmpKTEaYf:
447- ERROR: Python module indicator not found
448- ERROR: Python module launcher not found
449- ERROR: Python module messagemenu not found
450- ERROR: Python module soundmenu not found
451- ERROR: Python module notifications not found
452- usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
453- or: -c --help [cmd1 cmd2 ...]
454- or: -c --help-commands
455- or: -c cmd --help
456-
457- error: option --single-version-externally-managed not recognized
458-
459- ----------------------------------------
460
461=== modified file 'hello-unity/snapcraft.yaml'
462--- hello-unity/snapcraft.yaml 2016-04-14 14:47:59 +0000
463+++ hello-unity/snapcraft.yaml 2016-05-17 01:04:22 +0000
464@@ -1,5 +1,5 @@
465 name: hello-unity
466-version: 0.4-snap1
467+version: 0.4-snap2
468 summary: Unity APIs demonstration tool
469 description: Simple tool for demonstrating Unity's integration APIs
470
471@@ -9,21 +9,54 @@
472 plugs: [unity7]
473
474 parts:
475- hello-unity:
476- plugin: python2
477+ upstream-src:
478+ plugin: copy
479 source: lp:hello-unity
480 source-type: bzr
481+ files:
482+ hello-unity: opt/bin/hello-unity
483+ hello-unity.svg: usr/share/pixmaps/hello-unity.svg
484+ hello-unity-mono-light.svg: usr/share/pixmaps/hello-unity-mono-light.svg
485+ hello-unity-attention.svg: usr/share/pixmaps/hello-unity-attention.svg
486+ hello-unity-mono-dark.svg: usr/share/pixmaps/hello-unity-mono-dark.svg
487+
488+ patches:
489+ plugin: quilt
490+ source: ./patches
491+ stage-packages: [python-xdg]
492+ target-part: upstream-src
493+ after: [upstream-src]
494+
495+ setup:
496+ plugin: python2
497+ source: ./parts/upstream-src/src/
498 build-packages:
499 - python-distutils-extra
500+ after: [patches]
501+
502+ deps:
503+ plugin: nil
504 stage-packages:
505- - python-distutils-extra
506+ - python-gi
507 - gir1.2-unity-5.0
508 - gir1.2-notify-0.7
509 - gir1.2-appindicator3-0.1
510 - gir1.2-indicate-0.7
511+ - gir1.2-messagingmenu-1.0
512 - gir1.2-gtk-3.0
513 - gir1.2-gtksource-3.0
514
515+ integration:
516+ plugin: nil
517+ stage-packages:
518+ - dmz-cursor-theme
519+ - indicator-sound
520+ - light-themes
521+ - ttf-ubuntu-font-family
522+ snap:
523+ - usr/share
524+ - -usr/share/doc
525+
526 environment:
527 plugin: copy
528 files:

Subscribers

People subscribed via source and target branches