Merge lp:~dobey/ubuntuone-installer/update-from-trunk into lp:ubuntuone-installer/stable-3-0

Proposed by dobey on 2012-03-06
Status: Merged
Approved by: dobey on 2012-03-06
Approved revision: no longer in the source branch.
Merged at revision: 33
Proposed branch: lp:~dobey/ubuntuone-installer/update-from-trunk
Merge into: lp:ubuntuone-installer/stable-3-0
Diff against target: 73 lines (+22/-8)
2 files modified
ubuntuone/installer/__init__.py (+2/-0)
ubuntuone/installer/gui.py (+20/-8)
To merge this branch: bzr merge lp:~dobey/ubuntuone-installer/update-from-trunk
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve on 2012-03-06
Natalia Bidart 2012-03-06 Approve on 2012-03-06
Review via email: mp+96207@code.launchpad.net

Commit Message

Only install packages that haven't yet been installed.
Use gettext.install so gettext will return unicode objects instead of bytes.

To post a comment you must log in.
Natalia Bidart (nataliabidart) wrote :

Looks good.

review: Approve
29. By dobey on 2012-03-06

Only install packages that haven't yet been installed.
Use gettext.install so gettext will return unicode objects instead of bytes.

Eric Casteleijn (thisfred) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/installer/__init__.py'
2--- ubuntuone/installer/__init__.py 2012-02-17 21:46:16 +0000
3+++ ubuntuone/installer/__init__.py 2012-03-06 18:20:23 +0000
4@@ -19,6 +19,8 @@
5
6 from gi.repository import GLib
7
8+CLIENT_SHELL_PACKAGE = 'ubuntuone-client-gnome'
9+
10 CONTROL_PANEL_COMMAND = 'ubuntuone-control-panel-qt'
11 CONTROL_PANEL_PACKAGE = 'ubuntuone-control-panel-qt'
12
13
14=== modified file 'ubuntuone/installer/gui.py'
15--- ubuntuone/installer/gui.py 2012-02-22 16:36:54 +0000
16+++ ubuntuone/installer/gui.py 2012-03-06 18:20:23 +0000
17@@ -21,9 +21,11 @@
18 import os
19
20 from gi.repository import Gtk, GObject, GLib, Gdk, Pango
21-from ubuntuone.installer import (CONTROL_PANEL_COMMAND,
22+from ubuntuone.installer import (CLIENT_SHELL_PACKAGE,
23+ CONTROL_PANEL_COMMAND,
24 CONTROL_PANEL_PACKAGE,
25- MUSIC_STORE_PACKAGE)
26+ MUSIC_STORE_PACKAGE,
27+ is_installed)
28
29 # Some shenanigans to deal with pyflakes complaining
30 inline_callbacks = None
31@@ -35,8 +37,9 @@
32 if inline_callbacks is None:
33 inline_callbacks = old_callbacks
34
35-gettext.textdomain('ubuntuone-installer')
36-_ = gettext.gettext
37+gettext.install(domain='ubuntuone-installer', unicode=True)
38+if '_' not in __builtins__:
39+ _ = gettext.gettext
40
41
42 class UnsupportedDistribution(BaseException):
43@@ -195,6 +198,18 @@
44 if os.path.exists(path):
45 return path
46
47+ def __get_package_list(self):
48+ """Build the list of packages, to only include non-installed ones."""
49+ packages = []
50+ if not is_installed(CONTROL_PANEL_PACKAGE, CONTROL_PANEL_COMMAND):
51+ packages.append(CONTROL_PANEL_PACKAGE)
52+ if not is_installed(MUSIC_STORE_PACKAGE):
53+ packages.append(MUSIC_STORE_PACKAGE)
54+ if not is_installed(CLIENT_SHELL_PACKAGE):
55+ packages.append(CLIENT_SHELL_PACKAGE)
56+
57+ return packages
58+
59 def __got_response(self, dialog, response):
60 """Handle the dialog response actions."""
61 if response in [Gtk.ResponseType.CANCEL,
62@@ -361,10 +376,7 @@
63 Gtk.main_quit()
64
65 transaction = yield self.client.install_packages(
66- package_names=[MUSIC_STORE_PACKAGE,
67- 'ubuntuone-client-gnome',
68- CONTROL_PANEL_PACKAGE,
69- ])
70+ package_names=self.__get_package_list())
71 transaction.connect('finished', finished)
72 self.__apt_progress.set_transaction(transaction)
73 transaction.run()

Subscribers

People subscribed via source and target branches

to all changes: