[pygobject/invoke-rewrite] use PyCapsule when importing pycairo/require pycairo 1.10.0 for python3 builds



commit d1f1f4ccc55f9ecab73b7c0ee78762c4039b2c79
Author: John (J5) Palmieri <johnp redhat com>
Date:   Wed Apr 27 15:47:19 2011 -0400

    use PyCapsule when importing pycairo/require pycairo 1.10.0 for python3 builds
    
    * PyCObject is deprecated and pycairo 1.10.0 is first release to fix this issue

 configure.ac            |   15 +++++++++++----
 gi/pygi-foreign-cairo.c |    2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c39d19a..ad35f96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,8 @@ m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pyg
 
 dnl versions of packages we require ...
 m4_define(introspection_required_version, 0.10.2)
-m4_define(pycairo_required_version, 1.2.0)
+m4_define(py2cairo_required_version, 1.2.0)
+m4_define(py3cairo_required_version, 1.10.0)
 m4_define(glib_required_version, 2.24.0)
 m4_define(gio_required_version, 2.24.0)
 
@@ -236,9 +237,15 @@ if test "$enable_introspection" != no; then
     AC_SUBST(GI_DATADIR)
 
     if test "$enable_cairo" != no; then
-        PKG_CHECK_MODULES(PYCAIRO,
-            pycairo >= pycairo_required_version
-        )
+        if test $build_py3k = true; then  
+            PKG_CHECK_MODULES(PYCAIRO,
+                py3cairo >= py3cairo_required_version
+            )
+        else
+            PKG_CHECK_MODULES(PYCAIRO,
+                pycairo >= py2cairo_required_version
+            )
+        fi
     fi
 fi
 AM_CONDITIONAL(ENABLE_INTROSPECTION, test "$enable_introspection" = "yes")
diff --git a/gi/pygi-foreign-cairo.c b/gi/pygi-foreign-cairo.c
index 8353294..af84733 100644
--- a/gi/pygi-foreign-cairo.c
+++ b/gi/pygi-foreign-cairo.c
@@ -118,7 +118,7 @@ PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
 #if PY_VERSION_HEX < 0x03000000
     Pycairo_IMPORT;
 #else
-    Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import("cairo", "CAPI");
+    Pycairo_CAPI = (Pycairo_CAPI_t*) PyCapsule_Import("cairo.CAPI", 0);
 #endif
 
     if (Pycairo_CAPI == NULL)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]