]> git.pld-linux.org Git - packages/python-pygtk.git/commitdiff
- py27 fix. LP#636372 auto/th/python-pygtk-2_16_0-3
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 21 Sep 2010 18:47:17 +0000 (18:47 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    python-pygtk-python27.patch -> 1.1
    python-pygtk.spec -> 1.170

python-pygtk-python27.patch [new file with mode: 0644]
python-pygtk.spec

diff --git a/python-pygtk-python27.patch b/python-pygtk-python27.patch
new file mode 100644 (file)
index 0000000..9bbe2b5
--- /dev/null
@@ -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
index 0b474fee45dbd5d1a028414ef7c9192efc1b9182..6564ca34f533a03db02ecc1ce4c8e1b3e7c56c50 100644 (file)
@@ -10,7 +10,7 @@ Summary:      Python bindings for GTK+ 2.x libraries
 Summary(pl.UTF-8):     Wiązania Pythona do bibliotek GTK+ 2.x
 Name:          python-%{module}
 Version:       2.16.0
-Release:       2
+Release:       3
 Epoch:         2
 License:       LGPL v2.1+
 Group:         Libraries/Python
@@ -19,6 +19,7 @@ Source0:      http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.16/%{module}-%{version}.
 Source1:       %{name}-python.m4
 Source2:       %{name}-jhflags.m4
 Patch0:                %{name}-pyc.patch
+Patch1:     %{name}-python27.patch
 URL:           http://www.pygtk.org/
 BuildRequires: autoconf >= 2.52
 BuildRequires: automake >= 1:1.7
@@ -149,6 +150,7 @@ Dokumentacja API pygtk.
 %prep
 %setup -q -n %{module}-%{version}
 %patch0 -p1
+%patch1 -p1
 
 # don't remove it
 #mkdir m4
This page took 0.076521 seconds and 4 git commands to generate.