diff options
author | Danny Rawlins <monster.romster@gmail.com> | 2019-08-31 18:42:13 +1000 |
---|---|---|
committer | Danny Rawlins <monster.romster@gmail.com> | 2019-08-31 19:29:53 +1000 |
commit | 44656676857d209f5093112da63f64fbba422cc8 (patch) | |
tree | 2f440c22d4d8d887089b4f3e4d92eeec503bdf57 /pygtk | |
parent | 1d0a33b9e96815e77689ee2a208ac372abe23c87 (diff) | |
download | contrib-44656676857d209f5093112da63f64fbba422cc8.tar.gz contrib-44656676857d209f5093112da63f64fbba422cc8.tar.xz |
pygtk: opt -> contrib
Diffstat (limited to 'pygtk')
-rw-r--r-- | pygtk/.footprint | 193 | ||||
-rw-r--r-- | pygtk/.signature | 7 | ||||
-rw-r--r-- | pygtk/Pkgfile | 33 | ||||
-rw-r--r-- | pygtk/fix-leaks-of-pango-objects.patch | 59 | ||||
-rw-r--r-- | pygtk/python27.patch | 50 |
5 files changed, 342 insertions, 0 deletions
diff --git a/pygtk/.footprint b/pygtk/.footprint new file mode 100644 index 000000000..93e51a73e --- /dev/null +++ b/pygtk/.footprint @@ -0,0 +1,193 @@ +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/bin/ +-rwxr-xr-x root/root usr/bin/pygtk-codegen-2.0 +-rwxr-xr-x root/root usr/bin/pygtk-demo +drwxr-xr-x root/root usr/include/ +drwxr-xr-x root/root usr/include/pygtk-2.0/ +drwxr-xr-x root/root usr/include/pygtk-2.0/pygtk/ +-rw-r--r-- root/root usr/include/pygtk-2.0/pygtk/pygtk.h +drwxr-xr-x root/root usr/lib/ +drwxr-xr-x root/root usr/lib/pkgconfig/ +-rw-r--r-- root/root usr/lib/pkgconfig/pygtk-2.0.pc +drwxr-xr-x root/root usr/lib/pygtk/ +drwxr-xr-x root/root usr/lib/pygtk/2.0/ +drwxr-xr-x root/root usr/lib/pygtk/2.0/demos/ +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/__init__.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/__init__.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/__init__.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/appwindow.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/appwindow.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/appwindow.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/buttonbox.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/buttonbox.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/buttonbox.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/changedisplay.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/changedisplay.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/changedisplay.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/colorsel.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/colorsel.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/colorsel.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/dialogs.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/dialogs.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/dialogs.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/dnd.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/dnd.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/dnd.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/dndpixmap.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/dndpixmap.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/dndpixmap.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/editable_cells.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/editable_cells.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/editable_cells.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/entry_completion.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/entry_completion.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/entry_completion.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/expander.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/expander.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/expander.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/hypertext.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/hypertext.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/hypertext.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images.pyo +drwxr-xr-x root/root usr/lib/pygtk/2.0/demos/images/ +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/alphatest.png +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/apple-red.png +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/background.jpg +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/floppybuddy.gif +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/gnome-applets.png +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/gnome-calendar.png +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/gnome-foot.png +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/gnome-gimp.png +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/gnome-gmush.png +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/gnome-gsame.png +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/gnu-keys.png +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/images/gtk-logo-rgb.gif +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/infobar.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/infobar.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/infobar.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/list_store.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/list_store.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/list_store.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/menu.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/menu.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/menu.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/panes.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/panes.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/panes.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/pixbufs.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/pixbufs.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/pixbufs.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/print_editor.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/print_editor.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/print_editor.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/sizegroup.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/sizegroup.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/sizegroup.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/statusicon.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/statusicon.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/statusicon.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/stock_browser.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/stock_browser.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/stock_browser.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/textscroll.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/textscroll.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/textscroll.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/textview.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/textview.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/textview.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/tooltip.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/tooltip.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/tooltip.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/tree_store.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/tree_store.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/tree_store.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/treemodel.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/treemodel.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/treemodel.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/ui_manager.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/ui_manager.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/demos/ui_manager.pyo +-rw-r--r-- root/root usr/lib/pygtk/2.0/pygtk-demo.py +-rw-r--r-- root/root usr/lib/pygtk/2.0/pygtk-demo.pyc +-rw-r--r-- root/root usr/lib/pygtk/2.0/pygtk-demo.pyo +drwxr-xr-x root/root usr/lib/python2.7/ +drwxr-xr-x root/root usr/lib/python2.7/site-packages/ +drwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/ +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/atk.la +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/atk.so +drwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/ +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.pyc +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.pyo +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/_gtk.la +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/_gtk.so +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/_lazyutils.py +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/_lazyutils.pyc +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/_lazyutils.pyo +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/compat.py +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/compat.pyc +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/compat.pyo +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/deprecation.py +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/deprecation.pyc +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/deprecation.pyo +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/glade.la +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/glade.so +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/keysyms.py +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/keysyms.pyc +-rw-r--r-- root/root usr/lib/python2.7/site-packages/gtk-2.0/gtk/keysyms.pyo +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/gtkunixprint.la +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/gtkunixprint.so +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/pango.la +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/pango.so +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/pangocairo.la +-rwxr-xr-x root/root usr/lib/python2.7/site-packages/gtk-2.0/pangocairo.so +drwxr-xr-x root/root usr/share/ +drwxr-xr-x root/root usr/share/pygtk/ +drwxr-xr-x root/root usr/share/pygtk/2.0/ +drwxr-xr-x root/root usr/share/pygtk/2.0/defs/ +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/atk-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/atk.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-2.10.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-2.12.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-2.14.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-2.16.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-2.18.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-2.20.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-2.22.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-2.24.defs (EMPTY) +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-base-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-base.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gdk.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.10-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.10.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.12-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.12.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.14-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.14.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.16-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.16.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.18-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.18.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.20-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.20.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.22-types.defs (EMPTY) +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.22.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.24-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-2.24.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-base-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-base.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-extrafuncs.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtk.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtkunixprint-2.12.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtkunixprint-2.14.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtkunixprint-base-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/gtkunixprint-base.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/libglade.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/pango-types.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/pango.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/pangocairo.defs +-rw-r--r-- root/root usr/share/pygtk/2.0/defs/pangocairo.override diff --git a/pygtk/.signature b/pygtk/.signature new file mode 100644 index 000000000..44052f9c8 --- /dev/null +++ b/pygtk/.signature @@ -0,0 +1,7 @@ +untrusted comment: verify with /etc/ports/contrib.pub +RWSagIOpLGJF3/kArwKB0SP5xbVY050Fo6LRNLms0veohDdnVegz38izSgFL4Lgy5oo0aQ6hQ2Qvnxovj9IqCOXIYFMt2DaLagE= +SHA256 (Pkgfile) = 9edec99f2a37a5118f97c411fed735b544be8c0f19feb4e45ec110caee4290a2 +SHA256 (.footprint) = 6d1e16b13d6a41f46564160687cc9ad0cbd71213381d505d806db4a03a26e561 +SHA256 (pygtk-2.24.0.tar.bz2) = cd1c1ea265bd63ff669e92a2d3c2a88eb26bcd9e5363e0f82c896e649f206912 +SHA256 (python27.patch) = 39a30456cba055a452bb55c74ef1ff2f5f7bfaad22855b4dd569ab009b56b682 +SHA256 (fix-leaks-of-pango-objects.patch) = 0ca9e910e9bb88897089dd19752a419aa78de15463df766cb19a1d0c2dd45bcb diff --git a/pygtk/Pkgfile b/pygtk/Pkgfile new file mode 100644 index 000000000..1f59cef8c --- /dev/null +++ b/pygtk/Pkgfile @@ -0,0 +1,33 @@ +# Description: set of bindings for the GTK widget set +# URL: http://www.pygtk.org/ +# Maintainer: Danny Rawlins, crux at romster dot me +# Depends on: libglade-compat python-cairo python-gobject-compat + +name=pygtk +version=2.24.0 +release=4 +source=(https://download.gnome.org/sources/$name/${version::4}/$name-$version.tar.bz2 + python27.patch + fix-leaks-of-pango-objects.patch) + +build() { + cd $name-$version + + # https://bugzilla.gnome.org/show_bug.cgi?id=623965 + patch -p1 -i $SRC/python27.patch + + # https://bugzilla.gnome.org/show_bug.cgi?id=660216 + patch -p1 -i $SRC/fix-leaks-of-pango-objects.patch + + PKG_CONFIG_PATH+="/usr/lib/pango-compat/pkgconfig:/usr/lib/libcairo-compat/pkgconfig" \ + ./configure --prefix=/usr + + sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool + + make + make DESTDIR=$PKG install + + install -m 0644 gtk/gtk-extrafuncs.defs $PKG/usr/share/pygtk/2.0/defs/ + + rm -r $PKG/usr/share/gtk-doc +} diff --git a/pygtk/fix-leaks-of-pango-objects.patch b/pygtk/fix-leaks-of-pango-objects.patch new file mode 100644 index 000000000..c935dd6f2 --- /dev/null +++ b/pygtk/fix-leaks-of-pango-objects.patch @@ -0,0 +1,59 @@ +From eca72baa5616fbe4dbebea43c7e5940847dc5ab8 Mon Sep 17 00:00:00 2001 +From: "Owen W. Taylor" <otaylor@fishsoup.net> +Date: Tue, 27 Sep 2011 00:17:52 -0400 +Subject: Fix leaks of Pango objects + +Gtk.PrintContext.create_pango_context() +Gtk.PrintContext.create_pango_layout() +pangocairo.CairoContext.create_layout() + +were leaking the objects they returned. + +https://bugzilla.gnome.org/show_bug.cgi?id=660216 + +diff --git a/gtk/gtk-2.10.defs b/gtk/gtk-2.10.defs +index 69c7e0c..faa45e1 100644 +--- a/gtk/gtk-2.10.defs ++++ b/gtk/gtk-2.10.defs +@@ -1388,12 +1388,14 @@ + (define-method create_pango_context + (of-object "GtkPrintContext") + (c-name "gtk_print_context_create_pango_context") ++ (caller-owns-return #t) + (return-type "PangoContext*") + ) + + (define-method create_pango_layout + (of-object "GtkPrintContext") + (c-name "gtk_print_context_create_pango_layout") ++ (caller-owns-return #t) + (return-type "PangoLayout*") + ) + +diff --git a/pangocairo.override b/pangocairo.override +index bb923e6..5101107 100644 +--- a/pangocairo.override ++++ b/pangocairo.override +@@ -118,11 +118,16 @@ _wrap_pango_cairo_update_context(PyGObject *self, PyObject *args, PyObject *kwar + static PyObject * + _wrap_pango_cairo_create_layout(PyGObject *self) + { +- PangoLayout *ret; ++ PangoLayout *layout; ++ PyObject *ret; + +- ret = pango_cairo_create_layout(PycairoContext_GET(self)); ++ layout = pango_cairo_create_layout(PycairoContext_GET(self)); + /* pygobject_new handles NULL checking */ +- return pygobject_new((GObject *)ret); ++ ret = pygobject_new((GObject *)layout); ++ if (layout) ++ g_object_unref(layout); ++ ++ return ret; + } + + static PyObject * +-- +cgit v0.10.2 + diff --git a/pygtk/python27.patch b/pygtk/python27.patch new file mode 100644 index 000000000..9bbe2b5ae --- /dev/null +++ b/pygtk/python27.patch @@ -0,0 +1,50 @@ +diff --git a/gtk/gtkmodule.c b/gtk/gtkmodule.c +index c0e1493..aa8cf10 100644 +--- a/gtk/gtkmodule.c ++++ b/gtk/gtkmodule.c +@@ -227,8 +227,12 @@ init_gtk(void) + pygtk_add_stock_items(d); + + /* extension API */ +- PyDict_SetItemString(d, "_PyGtk_API", +- o=PyCObject_FromVoidPtr(&functions, NULL)); ++#if PY_VERSION_HEX >= 0x02070000 ++ o = PyCapsule_New(&functions, "gtk._gtk._PyGtk_API", NULL); ++#else ++ o = PyCObject_FromVoidPtr(&functions, NULL); ++#endif ++ PyDict_SetItemString(d, "_PyGtk_API", o); + Py_DECREF(o); + + PyGtkDeprecationWarning = PyErr_NewException("gtk.GtkDeprecationWarning", +diff --git a/gtk/pygtk.h b/gtk/pygtk.h +index 573c3b9..e4c680f 100644 +--- a/gtk/pygtk.h ++++ b/gtk/pygtk.h +@@ -60,6 +60,18 @@ struct _PyGtk_FunctionStruct *_PyGtk_API; + + + /* a function to initialise the pygtk functions */ ++ ++/* Python 2.7 introduced the PyCapsule API and deprecated the CObject API */ ++#if PY_VERSION_HEX >= 0x02070000 ++#define init_pygtk() G_STMT_START { \ ++ void *capsule = PyCapsule_Import("gtk._gtk._PyGtk_API", 0); \ ++ if (!capsule) { \ ++ return; \ ++ } \ ++ _PyGtk_API = (struct _PyGtk_FunctionStruct*)capsule; \ ++} G_STMT_END ++#else /* PY_VERSION_HEX */ ++/* Python 2.6 and earlier use the CObject API */ + #define init_pygtk() G_STMT_START { \ + PyObject *pygtk = PyImport_ImportModule("gtk"); \ + if (pygtk != NULL) { \ +@@ -79,6 +91,7 @@ struct _PyGtk_FunctionStruct *_PyGtk_API; + return; \ + } \ + } G_STMT_END ++#endif /* PY_VERSION_HEX */ + + #endif + |