- Edit PyCapsule patch to only use PyCapsule in Python 3.x

since this effects header files which require other modules to
  be recompiled.  There is actually discussion upstream to undeprecate it
  for the 2.x series
This commit is contained in:
John (J5) Palmieri 2010-09-30 15:59:38 -04:00
parent 9a1804d420
commit a781b5c135
2 changed files with 10 additions and 4 deletions

View File

@ -20,7 +20,7 @@ index d1eaf05..551bb6f 100644
return 1;
}
-
+#if PY_VERSION_HEX >= 0x02070000
+#if PY_VERSION_HEX >= 0x03000000
+ PyGI_API = (struct PyGI_API*) PyCapsule_Import("gi._API", FALSE);
+#else
PyGI_API = (struct PyGI_API*) PyCObject_Import("gi", "_API");
@ -59,7 +59,7 @@ index bb7bcad..222fc8c 100644
#endif
+/* PyCObject superceded by PyCapsule on Python >= 2.7 */
+#if PY_VERSION_HEX >= 0x02070000
+#if PY_VERSION_HEX >= 0x03000000
+# define PYGLIB_PyCapsule_Check PyCapsule_CheckExact
+# define PYGLIB_PyCapsule_New(ptr, typename) \
+ PyCapsule_New(ptr, typename, NULL)
@ -138,7 +138,7 @@ index e75c890..c803634 100644
}
cobject = PyObject_GetAttrString(gobject, "_PyGObject_API");
+#if PY_VERSION_HEX >= 0x02070000
+#if PY_VERSION_HEX >= 0x03000000
+ if (cobject && PyCapsule_CheckExact(cobject))
+ _PyGObject_API = (struct _PyGObject_Functions *) PyCapsule_GetPointer(cobject, "gobject._PyGObject_API");
+

View File

@ -12,7 +12,7 @@
Name: pygobject2
Version: 2.26.0
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPLv2+
Group: Development/Languages
Summary: Python 2 bindings for GObject
@ -183,6 +183,12 @@ rm examples/Makefile*
%endif # with_python3
%changelog
* Thu Sep 30 2010 John (J5) Palmieri <johnp@redhat.com> - 2.26.0-4
- Edit PyCapsule patch to only use PyCapsule in Python 3.x
since this effects header files which require other modules to
be recompiled. There is actually discussion upstream to undeprecate it
for the 2.x series
* Tue Sep 28 2010 John (J5) Palmieri <johnp@redhat.com> - 2.26.0-3
- add patch to work with PyCapsule since PyCObject is removed from
Python 3.2 which we ship in rawhide