Merge lp:~pitti/ubuntu-sso-client/gi-fixes into lp:ubuntu-sso-client

Proposed by Martin Pitt on 2011-08-23
Status: Merged
Approved by: Natalia Bidart on 2011-08-23
Approved revision: 766
Merged at revision: 763
Proposed branch: lp:~pitti/ubuntu-sso-client/gi-fixes
Merge into: lp:ubuntu-sso-client
Diff against target: 24 lines (+8/-2)
1 file modified
ubuntu_sso/utils/txsecrets.py (+8/-2)
To merge this branch: bzr merge lp:~pitti/ubuntu-sso-client/gi-fixes
Reviewer Review Type Date Requested Status
Natalia Bidart 2011-08-23 Approve on 2011-08-23
Review via email: mp+72527@code.launchpad.net

Commit message

- Do not mix static with gi bindings (LP: #829186).

Description of the change

pygobject >= 2.90 is now absolutely zero tolerant against importing both the
static and the GI version of a particular library. This was mostly the case
with 2.28 as well, but did work in some cases (like "import gobject; from
gi.repository import Gtk", in particular for "glib" and "gobject"). These now
cause errors as well.

With this fix we can use the library from both programs with static bindings
(gobject, gtk), as well as from programs which use the gobject-introspection
bindings.

See bug 829186 for more details.

This is a dependency of
https://code.launchpad.net/~pitti/ubuntuone-client/gi-fixes/+merge/72447

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

Hi Martin!

The branch looks great, I'm approving. In order to have this branch being landed by tarmac (our bot lander), we'll need that the test run (triggered by ./run-tests) reports no lint errors. ATM, in natty, I'm getting this:

ubuntu_sso/utils/txsecrets.py:
    28: [E0611] No name 'GObject' in module 'gi.repository'

You need to wrap the from gi.repository import GObject like this:

else:
    # pylint: disable=E0611
    from gi.repository import GObject
    # pylint: enable=E0611

review: Approve
lp:~pitti/ubuntu-sso-client/gi-fixes updated on 2011-08-23
764. By Martin Pitt on 2011-08-23

add necessary pylint tags

765. By Martin Pitt on 2011-08-23

fix pylint tags

Natalia Bidart (nataliabidart) wrote :

Thanks for the fixes!

For some reason I can't debug right now, lint will not be happy unless I change the disables to something like this:

     25 # pylint: disable=E0611
     26 if 'gobject' in sys.modules:
     27 import gobject as GObject
     28 else:
     29 from gi.repository import GObject
     30 # pylint: enable=E0611

would you please perform this last change? Thanks!

lp:~pitti/ubuntu-sso-client/gi-fixes updated on 2011-08-23
766. By Martin Pitt on 2011-08-23

update pylint markers again as per Natalia's request

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/utils/txsecrets.py'
2--- ubuntu_sso/utils/txsecrets.py 2011-07-05 15:26:05 +0000
3+++ ubuntu_sso/utils/txsecrets.py 2011-08-23 12:16:24 +0000
4@@ -21,13 +21,19 @@
5 * http://code.confuego.org/secrets-xdg-specs/
6 """
7
8-import gobject
9+import sys
10+# pylint: disable=E0611
11+if 'gobject' in sys.modules:
12+ import gobject as GObject
13+else:
14+ from gi.repository import GObject
15+# pylint: enable=E0611
16 import dbus
17 from dbus.mainloop.glib import DBusGMainLoop
18 import dbus.mainloop.glib
19 from twisted.internet.defer import Deferred
20
21-gobject.threads_init()
22+GObject.threads_init()
23 dbus.mainloop.glib.threads_init()
24 DBusGMainLoop(set_as_default=True)
25

Subscribers

People subscribed via source and target branches