Merge lp:~pitti/ubiquity/pygobject-fixes into lp:ubiquity

Proposed by Martin Pitt
Status: Merged
Merged at revision: 5773
Proposed branch: lp:~pitti/ubiquity/pygobject-fixes
Merge into: lp:ubiquity
Diff against target: 429 lines (+70/-62)
12 files modified
bin/oem-config-remove-gtk (+2/-2)
bin/ubiquity-bluetooth-agent (+3/-3)
debian/changelog (+8/-0)
tests/test_timezone.py (+4/-4)
ubiquity/frontend/gtk_ui.py (+12/-12)
ubiquity/frontend/noninteractive.py (+7/-7)
ubiquity/gtkwidgets.py (+5/-5)
ubiquity/nm.py (+5/-5)
ubiquity/plugins/ubi-console-setup.py (+6/-6)
ubiquity/plugins/ubi-language.py (+3/-3)
ubiquity/plugins/ubi-timezone.py (+8/-8)
ubiquity/plugins/ubi-usersetup.py (+7/-7)
To merge this branch: bzr merge lp:~pitti/ubiquity/pygobject-fixes
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Approve
Review via email: mp+136327@code.launchpad.net

Description of the change

This branch fixes ubiquity to work with current pygobject (see current autopkgtest failure in -proposed), and fixes some long-deprecated API which pygobject 3.7.x now triggers warnings for.

Note that I get two test failures locally:

ERROR: test_interface_translated (test_gtkui.TestFrontend)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/martin/ubuntu/ubiquity/tests/test_gtkui.py", line 141, in test_interface_translated
    % missing_translations)
Exception: Missing translation for:
question_label, ubi_question_dialog

======================================================================
FAIL: test_windows_only (test_ubi_partman.TestCalculateAutopartitioningOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/martin/ubuntu/ubiquity/tests/test_ubi_partman.py", line 508, in test_windows_only
    self.assertIn('resize', options)
AssertionError: 'resize' not found in {'manual': PartitioningOption(title='Something else', desc='You can create or resize partitions yourself, or choose multiple partitions for Ubuntu.')}

----------------------------------------------------------------------

These happen with the old and new pygobject, and with and without the branch.
They might be a local problem on my checkout/workstation, of course; does that
tell anything to you?

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Fixed the two test suite failures that I have introduced in 5771, sorry for hassle.

I had to fix the pep8 & pyflakes warnings from your merge proposal. Next time, please run ./test/run-pep8 & ./test/run-pyflakes as well. (they are run as part part of clean target, as well as the shell syntax checks).

Merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/oem-config-remove-gtk'
2--- bin/oem-config-remove-gtk 2012-09-06 17:13:01 +0000
3+++ bin/oem-config-remove-gtk 2012-11-27 06:10:25 +0000
4@@ -26,10 +26,10 @@
5 import glob
6
7 from aptdaemon.gtk3widgets import AptProgressDialog
8-from gi.repository import GObject, Gtk
9+from gi.repository import GLib, Gtk
10 from aptdaemon import client, enums
11
12-loop = GObject.MainLoop()
13+loop = GLib.MainLoop()
14
15
16 def _on_failure(error):
17
18=== modified file 'bin/ubiquity-bluetooth-agent'
19--- bin/ubiquity-bluetooth-agent 2012-07-16 14:29:13 +0000
20+++ bin/ubiquity-bluetooth-agent 2012-11-27 06:10:25 +0000
21@@ -6,7 +6,7 @@
22 import dbus
23 import dbus.service
24 import dbus.mainloop.glib
25-from gi.repository import GObject
26+from gi.repository import GLib
27
28
29 class Rejected(dbus.DBusException):
30@@ -97,10 +97,10 @@
31 bus.get_object("org.bluez", manager.DefaultAdapter()),
32 "org.bluez.Adapter")
33 agent = Agent(bus, "/ubiquity/bluetooth/agent")
34- mainloop = GObject.MainLoop()
35+ mainloop = GLib.MainLoop()
36 adapter.RegisterAgent("/ubiquity/bluetooth/agent", "DisplayYesNo")
37 except dbus.exceptions.DBusException:
38 exit_handler()
39
40-GObject.timeout_add(300000, exit_handler)
41+GLib.timeout_add(300000, exit_handler)
42 mainloop.run()
43
44=== modified file 'debian/changelog'
45--- debian/changelog 2012-11-26 13:06:06 +0000
46+++ debian/changelog 2012-11-27 06:10:25 +0000
47@@ -14,6 +14,14 @@
48 * Fonconfig-voodoo is gone, not sure if some other "fontconfig"ury
49 should be called instead. (LP: #1043031)
50
51+ [ Martin Pitt ]
52+ * ubiquity/gtkwidgets.py: Don't use GObject.constants, just use the
53+ constants from GObject as intended. Fixes a crash with pygobject
54+ 3.7.2.
55+ * Use glib API from the GLib GI module instead of GObject. The latter
56+ has been deprecated for a long time and triggers warnings with pygobject
57+ 3.7.2.
58+
59 -- Colin Watson <cjwatson@ubuntu.com> Thu, 22 Nov 2012 16:25:28 +0000
60
61 ubiquity (2.13.3) raring; urgency=low
62
63=== modified file 'tests/test_timezone.py'
64--- tests/test_timezone.py 2012-11-22 16:27:21 +0000
65+++ tests/test_timezone.py 2012-11-27 06:10:25 +0000
66@@ -25,9 +25,9 @@
67 @mock.patch('gi.repository.Soup.Message')
68 @mock.patch('json.loads')
69 def test_city_entry(self, json_mock, *args):
70- from gi.repository import GObject
71+ from gi.repository import GLib
72
73- # Patch GObject.timeout_add_seconds to call the supplied function
74+ # Patch GLib.timeout_add_seconds to call the supplied function
75 # immediately rather than waiting for the interval to expire.
76 def side_effect_factory(real_method):
77 def side_effect(interval, function, data):
78@@ -35,8 +35,8 @@
79 return side_effect
80
81 json_mock.return_value = []
82- real_method = GObject.timeout_add_seconds
83- method = mock.patch('gi.repository.GObject.timeout_add_seconds')
84+ real_method = GLib.timeout_add_seconds
85+ method = mock.patch('gi.repository.GLib.timeout_add_seconds')
86 timeout_mock = method.start()
87 timeout_mock.side_effect = side_effect_factory(real_method)
88 self.addCleanup(method.stop)
89
90=== modified file 'ubiquity/frontend/gtk_ui.py'
91--- ubiquity/frontend/gtk_ui.py 2012-10-19 01:18:48 +0000
92+++ ubiquity/frontend/gtk_ui.py 2012-11-27 06:10:25 +0000
93@@ -49,7 +49,7 @@
94
95 #in query mode we won't be in X, but import needs to pass
96 if 'DISPLAY' in os.environ:
97- from gi.repository import Gtk, Gdk, GObject
98+ from gi.repository import Gtk, Gdk, GObject, GLib
99 GObject.threads_init()
100 from ubiquity import gtkwidgets
101
102@@ -468,13 +468,13 @@
103 sys.exit(1)
104
105 def network_change(self, online=False):
106- from gi.repository import GObject
107+ from gi.repository import GLib
108 if not online:
109 self.set_online_state(False)
110 return
111 if self.timeout_id:
112- GObject.source_remove(self.timeout_id)
113- self.timeout_id = GObject.timeout_add(300, self.check_returncode)
114+ GLib.source_remove(self.timeout_id)
115+ self.timeout_id = GLib.timeout_add(300, self.check_returncode)
116
117 def set_online_state(self, state):
118 for p in self.pages:
119@@ -751,7 +751,7 @@
120
121 if self.dbfilter is not None and self.dbfilter != old_dbfilter:
122 self.allow_change_step(False)
123- GObject.idle_add(
124+ GLib.idle_add(
125 lambda: self.dbfilter.start(auto_process=True))
126
127 page.controller.dbfilter = self.dbfilter
128@@ -1448,17 +1448,17 @@
129 # Callbacks provided to components.
130
131 def watch_debconf_fd(self, from_debconf, process_input):
132- GObject.io_add_watch(from_debconf,
133- GObject.IO_IN | GObject.IO_ERR | GObject.IO_HUP,
134- self.watch_debconf_fd_helper, process_input)
135+ GLib.io_add_watch(from_debconf,
136+ GLib.IO_IN | GLib.IO_ERR | GLib.IO_HUP,
137+ self.watch_debconf_fd_helper, process_input)
138
139 def watch_debconf_fd_helper(self, source, cb_condition, callback):
140 debconf_condition = 0
141- if (cb_condition & GObject.IO_IN) != 0:
142+ if (cb_condition & GLib.IO_IN) != 0:
143 debconf_condition |= filteredcommand.DEBCONF_IO_IN
144- if (cb_condition & GObject.IO_ERR) != 0:
145+ if (cb_condition & GLib.IO_ERR) != 0:
146 debconf_condition |= filteredcommand.DEBCONF_IO_ERR
147- if (cb_condition & GObject.IO_HUP) != 0:
148+ if (cb_condition & GLib.IO_HUP) != 0:
149 debconf_condition |= filteredcommand.DEBCONF_IO_HUP
150
151 return callback(source, debconf_condition)
152@@ -1751,7 +1751,7 @@
153
154 def quit_quit():
155 # Wait until we're actually out of this main loop
156- GObject.idle_add(idle_quit)
157+ GLib.idle_add(idle_quit)
158 return False
159
160 if self.pending_quits == 0:
161
162=== modified file 'ubiquity/frontend/noninteractive.py'
163--- ubiquity/frontend/noninteractive.py 2012-09-25 20:59:09 +0000
164+++ ubiquity/frontend/noninteractive.py 2012-11-27 06:10:25 +0000
165@@ -30,7 +30,7 @@
166 import signal
167 import sys
168
169-from gi.repository import GObject
170+from gi.repository import GLib
171
172 from ubiquity import filteredcommand, i18n
173 from ubiquity import misc
174@@ -53,7 +53,7 @@
175 self.progress_position = ubiquity.progressposition.ProgressPosition()
176 self.progress_val = 0
177 self.progress_info = ''
178- self.mainloop = GObject.MainLoop()
179+ self.mainloop = GLib.MainLoop()
180
181 self.pages = []
182 for mod in self.modules:
183@@ -137,17 +137,17 @@
184 from the filtered command and a process_input callback which should
185 be called when input events are received."""
186
187- GObject.io_add_watch(from_debconf,
188- GObject.IO_IN | GObject.IO_ERR | GObject.IO_HUP,
189+ GLib.io_add_watch(from_debconf,
190+ GLib.IO_IN | GLib.IO_ERR | GLib.IO_HUP,
191 self.watch_debconf_fd_helper, process_input)
192
193 def watch_debconf_fd_helper(self, source, cb_condition, callback):
194 debconf_condition = 0
195- if (cb_condition & GObject.IO_IN) != 0:
196+ if (cb_condition & GLib.IO_IN) != 0:
197 debconf_condition |= filteredcommand.DEBCONF_IO_IN
198- if (cb_condition & GObject.IO_ERR) != 0:
199+ if (cb_condition & GLib.IO_ERR) != 0:
200 debconf_condition |= filteredcommand.DEBCONF_IO_ERR
201- if (cb_condition & GObject.IO_HUP) != 0:
202+ if (cb_condition & GLib.IO_HUP) != 0:
203 debconf_condition |= filteredcommand.DEBCONF_IO_HUP
204
205 return callback(source, debconf_condition)
206
207=== modified file 'ubiquity/gtkwidgets.py'
208--- ubiquity/gtkwidgets.py 2012-11-22 16:27:21 +0000
209+++ ubiquity/gtkwidgets.py 2012-11-27 06:10:25 +0000
210@@ -39,10 +39,10 @@
211 __gproperties__ = {
212 'radius': (
213 GObject.TYPE_INT, 'Radius', 'The radius of the rounded corners.',
214- 0, GObject.constants.G_MAXINT, 10, GObject.PARAM_READWRITE),
215+ 0, GObject.G_MAXINT, 10, GObject.PARAM_READWRITE),
216 'width': (
217 GObject.TYPE_INT, 'Width', 'The width of the outline.',
218- 0, GObject.constants.G_MAXINT, 1, GObject.PARAM_READWRITE),
219+ 0, GObject.G_MAXINT, 1, GObject.PARAM_READWRITE),
220 }
221
222 def __init__(self):
223@@ -93,15 +93,15 @@
224 'part_size': (
225 GObject.TYPE_UINT64, 'Partition size',
226 'The size of the partition being resized',
227- 1, GObject.constants.G_MAXUINT64, 100, GObject.PARAM_READWRITE),
228+ 1, GObject.G_MAXUINT64, 100, GObject.PARAM_READWRITE),
229 'min_size': (
230 GObject.TYPE_UINT64, 'Minimum size',
231 'The minimum size that the existing partition can be resized to',
232- 0, GObject.constants.G_MAXUINT64, 0, GObject.PARAM_READWRITE),
233+ 0, GObject.G_MAXUINT64, 0, GObject.PARAM_READWRITE),
234 'max_size': (
235 GObject.TYPE_UINT64, 'Maximum size',
236 'The maximum size that the existing partition can be resized to',
237- 1, GObject.constants.G_MAXUINT64, 100, GObject.PARAM_READWRITE)
238+ 1, GObject.G_MAXUINT64, 100, GObject.PARAM_READWRITE)
239 }
240
241 def do_get_property(self, prop):
242
243=== modified file 'ubiquity/nm.py'
244--- ubiquity/nm.py 2012-07-16 14:29:13 +0000
245+++ ubiquity/nm.py 2012-11-27 06:10:25 +0000
246@@ -4,7 +4,7 @@
247 import dbus
248 from dbus.mainloop.glib import DBusGMainLoop
249 DBusGMainLoop(set_as_default=True)
250-from gi.repository import Gtk, GObject
251+from gi.repository import Gtk, GObject, GLib
252
253 NM = 'org.freedesktop.NetworkManager'
254 NM_DEVICE = 'org.freedesktop.NetworkManager.Device'
255@@ -174,8 +174,8 @@
256
257 def queue_build_cache(self, *args):
258 if self.timeout_id:
259- GObject.source_remove(self.timeout_id)
260- self.timeout_id = GObject.timeout_add(500, self.build_cache)
261+ GLib.source_remove(self.timeout_id)
262+ self.timeout_id = GLib.timeout_add(500, self.build_cache)
263
264 def properties_changed(self, props, path=None):
265 if 'Strength' in props:
266@@ -275,8 +275,8 @@
267
268 def queue_rows_changed(*args):
269 if self.rows_changed_id:
270- GObject.source_remove(self.rows_changed_id)
271- self.rows_changed_id = GObject.idle_add(self.rows_changed)
272+ GLib.source_remove(self.rows_changed_id)
273+ self.rows_changed_id = GLib.idle_add(self.rows_changed)
274
275 model.connect('row-inserted', queue_rows_changed)
276 model.connect('row-deleted', queue_rows_changed)
277
278=== modified file 'ubiquity/plugins/ubi-console-setup.py'
279--- ubiquity/plugins/ubi-console-setup.py 2012-11-22 16:27:21 +0000
280+++ ubiquity/plugins/ubi-console-setup.py 2012-11-27 06:10:25 +0000
281@@ -106,10 +106,10 @@
282 def on_keyboard_layout_selected(self, *args):
283 if not 'UBIQUITY_AUTOMATIC' in os.environ:
284 # Let's not call this every time the user presses a key.
285- from gi.repository import GObject
286+ from gi.repository import GLib
287 if self.keyboard_layout_timeout_id:
288- GObject.source_remove(self.keyboard_layout_timeout_id)
289- self.keyboard_layout_timeout_id = GObject.timeout_add(
290+ GLib.source_remove(self.keyboard_layout_timeout_id)
291+ self.keyboard_layout_timeout_id = GLib.timeout_add(
292 600, self.keyboard_layout_timeout)
293 else:
294 self.keyboard_layout_timeout()
295@@ -128,10 +128,10 @@
296 def on_keyboard_variant_selected(self, *args):
297 if not 'UBIQUITY_AUTOMATIC' in os.environ:
298 # Let's not call this every time the user presses a key.
299- from gi.repository import GObject
300+ from gi.repository import GLib
301 if self.keyboard_variant_timeout_id:
302- GObject.source_remove(self.keyboard_variant_timeout_id)
303- self.keyboard_variant_timeout_id = GObject.timeout_add(
304+ GLib.source_remove(self.keyboard_variant_timeout_id)
305+ self.keyboard_variant_timeout_id = GLib.timeout_add(
306 600, self.keyboard_variant_timeout)
307 else:
308 self.keyboard_variant_timeout()
309
310=== modified file 'ubiquity/plugins/ubi-language.py'
311--- ubiquity/plugins/ubi-language.py 2012-10-19 17:03:08 +0000
312+++ ubiquity/plugins/ubi-language.py 2012-11-27 06:10:25 +0000
313@@ -302,13 +302,13 @@
314 w.show()
315
316 def plugin_set_online_state(self, state):
317- from gi.repository import GObject
318+ from gi.repository import GLib
319 if self.release_notes_label:
320 if self.timeout_id:
321- GObject.source_remove(self.timeout_id)
322+ GLib.source_remove(self.timeout_id)
323 if state:
324 self.release_notes_label.show()
325- self.timeout_id = GObject.timeout_add(
326+ self.timeout_id = GLib.timeout_add(
327 300, self.check_returncode)
328 else:
329 self.release_notes_label.hide()
330
331=== modified file 'ubiquity/plugins/ubi-timezone.py'
332--- ubiquity/plugins/ubi-timezone.py 2012-10-19 17:03:08 +0000
333+++ ubiquity/plugins/ubi-timezone.py 2012-11-27 06:10:25 +0000
334@@ -97,7 +97,7 @@
335 self.controller.allow_go_forward(True)
336
337 def changed(self, entry):
338- from gi.repository import Gtk, GObject, Soup
339+ from gi.repository import Gtk, GObject, GLib, Soup
340
341 text = misc.utf8(self.city_entry.get_text())
342 if not text:
343@@ -119,9 +119,9 @@
344 message.request_headers.append('User-agent', 'Ubiquity/1.0')
345 self.geoname_session.abort()
346 if self.geoname_timeout_id is not None:
347- GObject.source_remove(self.geoname_timeout_id)
348+ GLib.source_remove(self.geoname_timeout_id)
349 self.geoname_timeout_id = \
350- GObject.timeout_add_seconds(2, self.geoname_timeout,
351+ GLib.timeout_add_seconds(2, self.geoname_timeout,
352 (text, model))
353 self.geoname_session.queue_message(message, self.geoname_cb,
354 (text, model))
355@@ -157,12 +157,12 @@
356 def geoname_cb(self, session, message, user_data):
357 import syslog
358 import json
359- from gi.repository import GObject, Soup
360+ from gi.repository import GLib, Soup
361
362 text, model = user_data
363
364 if self.geoname_timeout_id is not None:
365- GObject.source_remove(self.geoname_timeout_id)
366+ GLib.source_remove(self.geoname_timeout_id)
367 self.geoname_timeout_id = None
368 self.geoname_add_tzdb(text, model)
369
370@@ -192,7 +192,7 @@
371
372 def setup_page(self):
373 # TODO Put a frame around the completion to add contrast (LP: #605908)
374- from gi.repository import Gtk, GObject
375+ from gi.repository import Gtk, GLib
376 from gi.repository import TimezoneMap
377 self.tzdb = ubiquity.tz.Database()
378 self.tzmap = TimezoneMap.TimezoneMap()
379@@ -207,8 +207,8 @@
380
381 def queue_entry_changed(entry):
382 if self.timeout_id:
383- GObject.source_remove(self.timeout_id)
384- self.timeout_id = GObject.timeout_add(300, self.changed, entry)
385+ GLib.source_remove(self.timeout_id)
386+ self.timeout_id = GLib.timeout_add(300, self.changed, entry)
387
388 self.city_entry.connect('changed', queue_entry_changed)
389 completion = Gtk.EntryCompletion()
390
391=== modified file 'ubiquity/plugins/ubi-usersetup.py'
392--- ubiquity/plugins/ubi-usersetup.py 2012-11-22 16:27:21 +0000
393+++ ubiquity/plugins/ubi-usersetup.py 2012-11-27 06:10:25 +0000
394@@ -405,17 +405,17 @@
395
396 if not 'UBIQUITY_AUTOMATIC' in os.environ:
397 # Let's not call this every time the user presses a key.
398- from gi.repository import GObject
399+ from gi.repository import GLib
400 if self.hostname_timeout_id:
401- GObject.source_remove(self.hostname_timeout_id)
402- self.hostname_timeout_id = GObject.timeout_add(
403+ GLib.source_remove(self.hostname_timeout_id)
404+ self.hostname_timeout_id = GLib.timeout_add(
405 300, self.hostname_timeout, widget)
406
407 def lookup_result(self, resolver, result, unused):
408- from gi.repository import GObject
409+ from gi.repository import GLib
410 try:
411 resolver.lookup_by_name_finish(result)
412- except GObject.GError:
413+ except GLib.GError:
414 pass
415 else:
416 # FIXME: i18n
417@@ -437,10 +437,10 @@
418 hostname, None, self.bogus_lookup_result, None)
419
420 def bogus_lookup_result(self, resolver, result, unused):
421- from gi.repository import GObject
422+ from gi.repository import GLib
423 try:
424 resolver.lookup_by_name_finish(result)
425- except GObject.GError:
426+ except GLib.GError:
427 self.resolver_ok = True
428 else:
429 self.resolver_ok = False

Subscribers

People subscribed via source and target branches

to status/vote changes: