[python3-cairo] add patch to move to using PyCapsule API since PyCObject was removed from 3.2

John Palmieri (J5) johnp at fedoraproject.org
Tue Sep 28 20:00:53 UTC 2010


commit ab25357339064caf951218334c92e591c3c4c6a3
Author: John (J5) Palmieri <johnp at redhat.com>
Date:   Tue Sep 28 16:00:08 2010 -0400

    add patch to move to using PyCapsule API since PyCObject was removed from 3.2

 ...le-API-instead-of-the-deprecated-PyCObjec.patch |   40 ++++++++++++++++++++
 python3-cairo.spec                                 |    7 +++-
 2 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/0001-use-PyCapsule-API-instead-of-the-deprecated-PyCObjec.patch b/0001-use-PyCapsule-API-instead-of-the-deprecated-PyCObjec.patch
new file mode 100644
index 0000000..67a1b47
--- /dev/null
+++ b/0001-use-PyCapsule-API-instead-of-the-deprecated-PyCObjec.patch
@@ -0,0 +1,40 @@
+From 9d0e3399dfd0e1d34723d21607de1682d9dd3f01 Mon Sep 17 00:00:00 2001
+From: John (J5) Palmieri <johnp at redhat.com>
+Date: Tue, 28 Sep 2010 15:49:37 -0400
+Subject: [PATCH] use PyCapsule API instead of the deprecated PyCObject API
+
+* PyCObject is deprecated in 3.1 and removed in 3.2
+---
+ src/cairomodule.c |    2 +-
+ src/py3cairo.h    |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/cairomodule.c b/src/cairomodule.c
+index 58e665c..144757a 100644
+--- a/src/cairomodule.c
++++ b/src/cairomodule.c
+@@ -377,7 +377,7 @@ PyInit__cairo(void)
+ 		     (PyObject *)&PycairoXlibSurface_Type);
+ #endif
+ 
+-  PyModule_AddObject(m, "CAPI", PyCObject_FromVoidPtr(&CAPI, NULL));
++  PyModule_AddObject(m, "CAPI", PyCapsule_New(&CAPI, "cairo.CAPI", NULL));
+ 
+     /* constants */
+ #if CAIRO_HAS_ATSUI_FONT
+diff --git a/src/py3cairo.h b/src/py3cairo.h
+index 35b4240..d919d3c 100644
+--- a/src/py3cairo.h
++++ b/src/py3cairo.h
+@@ -199,7 +199,7 @@ typedef struct {
+  * 2) Add 'Pycairo_IMPORT;' to the init<module> function
+  */
+ #define Pycairo_IMPORT \
+-        Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import("cairo", "CAPI")
++        Pycairo_CAPI = (Pycairo_CAPI_t*) PyCapsule_Import("cairo.CAPI", 0)
+ 
+ #endif /* ifndef _INSIDE_PYCAIRO_ */
+ 
+-- 
+1.7.2.3
+
diff --git a/python3-cairo.spec b/python3-cairo.spec
index 3546f90..a7a9eed 100644
--- a/python3-cairo.spec
+++ b/python3-cairo.spec
@@ -4,7 +4,7 @@
 
 Name: python3-cairo
 Version: 1.8.10
-Release: 6%{?dist}
+Release: 7%{?dist}
 License: MPLv1.1 or LGPLv2
 Group: Development/Languages
 Summary: Python 3 bindings for the cairo library
@@ -13,6 +13,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 Source: http://cairographics.org/releases/pycairo-%{version}.tar.bz2
 
 Patch0: 0001-Add-support-for-libdir.patch
+Patch1: 0001-use-PyCapsule-API-instead-of-the-deprecated-PyCObjec.patch 
 ### Build Dependencies ###
 
 BuildRequires: cairo-devel >= %{cairo_version}
@@ -37,6 +38,7 @@ libraries so that they interoperate with python3-cairo.
 %prep
 %setup -q -n pycairo-%{version}
 %patch0 -p1 -b .add_libdir
+%patch1 -p1 -b .use_pycapsule
 
 %build
 # FIXME: we should be using the system version of waf (e.g. %{_bindir}/waf)
@@ -78,6 +80,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/pkgconfig/py3cairo.pc
 
 %changelog
+* Tue Sep 28 2010 John (J5) Palmieri <johnp at redhat.com> - 1.8.10-7
+- add patch to move to using PyCapsule API since PyCObject was removed from 3.2
+
 * Tue Sep 28 2010 John (J5) Palmieri <johnp at redhat.com> - 1.8.10-6
 - move defattr above the first file manifest item in the devel sub package 
 


More information about the scm-commits mailing list