Merge lp:~mandel/ubuntuone-client/spawn-cp into lp:ubuntuone-client

Proposed by Manuel de la Peña on 2012-10-11
Status: Merged
Approved by: Roberto Alsina on 2012-10-12
Approved revision: 1340
Merged at revision: 1340
Proposed branch: lp:~mandel/ubuntuone-client/spawn-cp
Merge into: lp:ubuntuone-client
Diff against target: 53 lines (+12/-2)
2 files modified
tests/platform/messaging/test_linux.py (+1/-1)
ubuntuone/platform/messaging/linux.py (+11/-1)
To merge this branch: bzr merge lp:~mandel/ubuntuone-client/spawn-cp
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve on 2012-10-12
Diego Sarmentero (community) 2012-10-11 Approve on 2012-10-11
Review via email: mp+129230@code.launchpad.net

Commit Message

- Ensure that the correct glib method is used when we cannot use the gir (LP: #1065272).

Description of the Change

- Ensure that the correct glib method is used when we cannot use the gir (LP: #1065272).

To post a comment you must log in.
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
Roberto Alsina (ralsina) wrote :

Makes sense.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/messaging/test_linux.py'
2--- tests/platform/messaging/test_linux.py 2012-10-01 13:32:57 +0000
3+++ tests/platform/messaging/test_linux.py 2012-10-11 16:00:38 +0000
4@@ -165,6 +165,6 @@
5 """Check that the proper action is executed."""
6 data = []
7
8- self.patch(linux.glib, "spawn_command_line_async", data.append)
9+ self.patch(linux, "spawn_command_line_async", data.append)
10 _server_callback(None)
11 self.assertEqual(data, ['ubuntuone-control-panel-qt'])
12
13=== modified file 'ubuntuone/platform/messaging/linux.py'
14--- ubuntuone/platform/messaging/linux.py 2012-10-01 14:44:30 +0000
15+++ ubuntuone/platform/messaging/linux.py 2012-10-11 16:00:38 +0000
16@@ -39,19 +39,29 @@
17
18 indicate = None
19 glib = None
20+spawn_command_line_async = None
21 try:
22 if 'gobject' in sys.modules and sys.modules['gobject'] is not None:
23+ import shlex
24 import indicate as pyindicate
25 import glib as GLib
26 indicate = pyindicate
27 glib = GLib
28 using_gi = False
29+
30+ def spawn_command_line(command_line):
31+ """Spawn the command line."""
32+ glib.spawn_async(shlex.split(command_line),
33+ flags=glib.SPAWN_SEARCH_PATH)
34+
35+ spawn_command_line_async = spawn_command_line
36 else:
37 from gi.repository import GLib
38 glib = GLib
39 from gi.repository import Indicate
40 indicate = Indicate
41 using_gi = True
42+ spawn_command_line_async = glib.spawn_command_line_async
43 except ImportError:
44 pass
45
46@@ -73,7 +83,7 @@
47 def _server_callback(the_indicator, message_time=None):
48 """Open the control panel to the shares tab."""
49 try:
50- glib.spawn_command_line_async('ubuntuone-control-panel-qt')
51+ spawn_command_line_async('ubuntuone-control-panel-qt')
52 except glib.GError as e:
53 logger.warning('Failed to open the control panel: %s' % e)
54

Subscribers

People subscribed via source and target branches