15
0
Files
python-Twisted/no-pygtkcompat.patch
Matej Cepl c7cf3cbca2 Accepting request 911968 from home:xanders:branches:devel:languages:python
In support of boo#1183833
- Restore no-pygtkcompat.patch due to boo#1110669 

Re: 880374
I'm pretty certain that the rpmlint warnings are not caused by the reintroduction of the patch. In fact these warnings are present in the existing devel:languages:python/python-Twisted repository right now (Rev 108), after multiple subsequently accepted requests since this was rejected 5 months ago. Can this request please be reconsidered, or can a package maintainer reintroduce the no-pygtkcompat patch of their own accord as part of regular Twisted maintenance?

OBS-URL: https://build.opensuse.org/request/show/911968
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=109
2021-08-13 12:50:12 +00:00

33 lines
1.5 KiB
Diff

diff -ur Twisted-21.7.0.orig/src/twisted/internet/gireactor.py Twisted-21.7.0/src/twisted/internet/gireactor.py
--- Twisted-21.7.0.orig/src/twisted/internet/gireactor.py
+++ Twisted-21.7.0/src/twisted/internet/gireactor.py
@@ -24,16 +24,21 @@
from twisted.internet.error import ReactorAlreadyRunning
from twisted.internet import _glibbase
from twisted.python import runtime
-import gi.pygtkcompat # type: ignore[import]
from gi.repository import GLib # type: ignore[import]
-# We require a sufficiently new version of pygobject, so always exists:
-_pygtkcompatPresent = True
+try:
+ import gi.pygtkcompat # type: ignore[import]
+except ImportError:
+ pass # This is probably Python 3, with pygtkcompat removed
+else:
+ # We require a sufficiently new version of pygobject, so always exists:
+ _pygtkcompatPresent = True
+
+ # 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.
+ gi.pygtkcompat.enable()
-# 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.
-gi.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