[notify-python] fix init.py so that it is able to load the needed GTK2 symbols from pygtk (bz 626852)

Tom Callaway spot at fedoraproject.org
Thu Sep 9 20:27:32 UTC 2010


commit aff714b471ab470ce5668db5d03205c18904de88
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Thu Sep 9 16:27:38 2010 -0400

    fix init.py so that it is able to load the needed GTK2 symbols from pygtk (bz 626852)

 notify-python-0.1.1-fix-GTK-symbols.patch |   25 +++++++++++++++++++++++++
 notify-python.spec                        |    7 ++++++-
 2 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/notify-python-0.1.1-fix-GTK-symbols.patch b/notify-python-0.1.1-fix-GTK-symbols.patch
new file mode 100644
index 0000000..f985c01
--- /dev/null
+++ b/notify-python-0.1.1-fix-GTK-symbols.patch
@@ -0,0 +1,25 @@
+diff -up notify-python-0.1.1/src/__init__.py.BAD notify-python-0.1.1/src/__init__.py
+--- notify-python-0.1.1/src/__init__.py.BAD	2010-08-31 09:04:45.353844005 -0400
++++ notify-python-0.1.1/src/__init__.py	2010-08-31 09:04:49.281844300 -0400
+@@ -1 +1,21 @@
++"""
++Fedora's libnotify.so is not linked against GTK2 or GTK3. The idea
++was to support being linked against different parallel-installable
++GTK stacks.
++
++Unfortunately, python needs to jump through some special hoops in order
++to share symbols with extension modules, specifically, pygtk, which does
++link against GTK2.
++
++Without using sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL),
++the result is:
++libnotify-WARNING **: Missing symbol 'gdk_screen_make_display_name'
++
++Thanks to David Malcolm for figuring out the workaround.
++"""
++import ctypes
++import sys
++sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
++import gtk
++
+ from _pynotify import *
diff --git a/notify-python.spec b/notify-python.spec
index 9520520..cc175a7 100644
--- a/notify-python.spec
+++ b/notify-python.spec
@@ -2,13 +2,14 @@
 
 Name:           notify-python
 Version:        0.1.1
-Release:        14%{?dist}
+Release:        15%{?dist}
 Summary:        Python bindings for libnotify
 
 Group:          Development/Languages
 # No version specified, just COPYING.
 License:        LGPLv2+
 Source0:        http://www.galago-project.org/files/releases/source/notify-python/notify-python-%{version}.tar.bz2
+Patch0:         notify-python-0.1.1-fix-GTK-symbols.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  python-devel, pkgconfig, libnotify-devel, pygtk2-devel
@@ -24,6 +25,7 @@ Python bindings for libnotify
 
 %prep
 %setup -q
+%patch0 -p1 -b .fix-GTK-symbols
 
 # WARNING - we touch src/pynotify.override in build because upstream did not rebuild pynotify.c
 # from the input definitions, this forces pynotify.c to be regenerated, at some point this can be removed
@@ -53,6 +55,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/pkgconfig/%{name}.pc
 
 %changelog
+* Thu Sep  9 2010 Tom "spot" Callaway <tcallawa at redhat.com> - 0.1.1-15
+- fix init.py so that it is able to load the needed GTK2 symbols from pygtk (bz 626852)
+
 * Fri Jul 30 2010 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.1.1-14
 - Remove the previous workaround (no longer needed)
 


More information about the scm-commits mailing list