From 3b0483a3c73d8563a8a6e0cd41d64db4eeff14e4 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Fri, 1 Jul 2011 12:41:52 +0200
Subject: [PATCH] notify-python: clean up deps, patches from Arch to make it
 build.

---
 .../notify-python/patches/libnotify07.patch   | 36 +++++++++++++++++++
 .../notify-python-0.1.1-fix-GTK-symbols.patch | 25 +++++++++++++
 srcpkgs/notify-python/template                |  8 +++--
 3 files changed, 66 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/notify-python/patches/libnotify07.patch
 create mode 100644 srcpkgs/notify-python/patches/notify-python-0.1.1-fix-GTK-symbols.patch

diff --git a/srcpkgs/notify-python/patches/libnotify07.patch b/srcpkgs/notify-python/patches/libnotify07.patch
new file mode 100644
index 0000000000..289573d50a
--- /dev/null
+++ b/srcpkgs/notify-python/patches/libnotify07.patch
@@ -0,0 +1,36 @@
+diff -up notify-python-0.1.1/src/pynotify.defs.notify070 notify-python-0.1.1/src/pynotify.defs
+--- notify-python-0.1.1/src/pynotify.defs.notify070	2010-11-02 17:11:14.928179237 -0400
++++ notify-python-0.1.1/src/pynotify.defs	2010-11-02 17:11:51.153180231 -0400
+@@ -38,7 +38,6 @@
+     '("const-gchar*" "summary")
+     '("const-gchar*" "message" (null-ok) (default "NULL"))
+     '("const-gchar*" "icon" (null-ok) (default "NULL"))
+-    '("GtkWidget*" "attach" (null-ok) (default "NULL"))
+   )
+ )
+ 
+@@ -53,24 +52,6 @@
+   )
+ )
+ 
+-(define-method attach_to_widget
+-  (of-object "NotifyNotification")
+-  (c-name "notify_notification_attach_to_widget")
+-  (return-type "none")
+-  (parameters
+-    '("GtkWidget*" "attach")
+-  )
+-)
+-
+-(define-method attach_to_status_icon
+-  (of-object "NotifyNotification")
+-  (c-name "notify_notification_attach_to_status_icon")
+-  (return-type "none")
+-  (parameters
+-    '("GtkStatusIcon*" "attach")
+-  )
+-)
+-
+ (define-method show
+   (of-object "NotifyNotification")
+   (c-name "notify_notification_show")
diff --git a/srcpkgs/notify-python/patches/notify-python-0.1.1-fix-GTK-symbols.patch b/srcpkgs/notify-python/patches/notify-python-0.1.1-fix-GTK-symbols.patch
new file mode 100644
index 0000000000..f985c01363
--- /dev/null
+++ b/srcpkgs/notify-python/patches/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/srcpkgs/notify-python/template b/srcpkgs/notify-python/template
index 35c1bad006..1698e92312 100644
--- a/srcpkgs/notify-python/template
+++ b/srcpkgs/notify-python/template
@@ -1,7 +1,8 @@
 # Template file for 'notify-python'
 pkgname=notify-python
 version=0.1.1
-revision=3
+revision=4
+patch_args="-Np1"
 distfiles="http://www.galago-project.org/files/releases/source/$pkgname/$pkgname-$version.tar.gz"
 build_style=gnu_configure
 short_desc="Python bindings for libnotify"
@@ -28,6 +29,7 @@ Add_dependency run libpng
 Add_dependency run freetype
 Add_dependency run fontconfig
 Add_dependency run dbus-libs
+Add_dependency run pygtk
 
 Add_dependency build libnotify-devel
 Add_dependency build gtk+-devel
@@ -41,5 +43,5 @@ Add_dependency build libpng-devel
 Add_dependency build freetype-devel
 Add_dependency build fontconfig-devel
 Add_dependency build dbus-devel
-
-Add_dependency full pygtk
+Add_dependency build python-devel
+Add_dependency build pygtk-devel