File lp1102685.diff of Package python-Twisted
=== modified file 'twisted/internet/gireactor.py'
Index: Twisted-15.0.0/twisted/internet/gireactor.py
===================================================================
--- Twisted-15.0.0.orig/twisted/internet/gireactor.py
+++ Twisted-15.0.0/twisted/internet/gireactor.py
@@ -37,9 +37,12 @@ else:
from twisted.python.modules import theSystemPath
_pygtkcompatPresent = True
try:
- theSystemPath["gi.pygtkcompat"]
+ theSystemPath["pygtkcompat"]
except KeyError:
- _pygtkcompatPresent = False
+ try:
+ theSystemPath["gi.pygtkcompat"]
+ except KeyError:
+ _pygtkcompatPresent = False
# Modules that we want to ensure aren't imported if we're on older versions of
@@ -75,8 +78,11 @@ else:
# Newer version of gi, so we can try to initialize compatibility layer; if
# real pygtk was already imported we'll get ImportError at this point
# rather than segfault, so unconditional import is fine.
- import gi.pygtkcompat
- gi.pygtkcompat.enable()
+ try:
+ import pygtkcompat
+ except ImportError:
+ from gi import pygtkcompat
+ pygtkcompat.enable()
# At this point importing gobject will get you gi version, and importing
# e.g. gtk will either fail in non-segfaulty way or use gi version if user
# does gi.pygtkcompat.enable_gtk(). So, no need to prevent imports of