[glade/margins] Bump pygobject requisite to pygobject 3. Fixes bug #658667.



commit a233cf2f4a6deef221c2477f56e841533d5d056c
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Mon Sep 19 16:57:05 2011 -0300

    Bump pygobject requisite to pygobject 3. Fixes bug #658667.

 ChangeLog                     |    5 +++++
 configure.ac                  |    8 ++++----
 plugins/python/glade-python.c |   38 +++++++++++++++++++++-----------------
 3 files changed, 30 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0cbfccf..c100d92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-19 Ignacio Casal Quinteiro <icq gnome org>
+
+        * configure.ac, plugins/python/glade-python.c:
+          Bump pygobject requisite to pygobject 3. Fixes bug #658667.
+
 2011-06-14  Juan Pablo Ugarte <juanpablougarte gmail com>
 
 	* gladeui/glade-project.h:
diff --git a/configure.ac b/configure.ac
index d24cf2f..faa003d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,10 +144,10 @@ AM_CONDITIONAL(HAVE_GTK_UNIX_PRINT, test x"$have_unix_print" = "xyes")
 dnl ================================================================
 dnl Python for optional python dev libs
 dnl ================================================================
-PYGOBJECT_REQS=2.27.0
+PYGOBJECT_REQS=2.90.4
 PYGOBJECT_REQUIRED_MAJOR=2
-PYGOBJECT_REQUIRED_MINOR=27
-PYGOBJECT_REQUIRED_MICRO=0
+PYGOBJECT_REQUIRED_MINOR=90
+PYGOBJECT_REQUIRED_MICRO=4
 
 AC_ARG_ENABLE(python,
     AS_HELP_STRING([--disable-python], [disable python catalog]),
@@ -156,7 +156,7 @@ AC_ARG_ENABLE(python,
 if test x"$check_python" = x"yes"; then
   have_python=yes
 
-  PKG_CHECK_MODULES([PYGOBJECT],[pygobject-2.0 >= ${PYGOBJECT_REQUIRED_MAJOR}.${PYGOBJECT_REQUIRED_MINOR}.${PYGOBJECT_REQUIRED_MICRO}],[have_pygobject=yes],[have_pygobject=no])
+  PKG_CHECK_MODULES([PYGOBJECT],[pygobject-3.0 >= ${PYGOBJECT_REQUIRED_MAJOR}.${PYGOBJECT_REQUIRED_MINOR}.${PYGOBJECT_REQUIRED_MICRO}],[have_pygobject=yes],[have_pygobject=no])
 
   AM_CHECK_PYTHON_HEADERS(, [have_python_headers=no])
   AM_CHECK_PYTHON_LIBS(, [have_python_lib=no])
diff --git a/plugins/python/glade-python.c b/plugins/python/glade-python.c
index 833b7de..14a2679 100644
--- a/plugins/python/glade-python.c
+++ b/plugins/python/glade-python.c
@@ -44,29 +44,33 @@ python_init (void)
 static void
 glade_python_init_pygobject_check (gint req_major, gint req_minor, gint req_micro)
 {
-  PyObject *gobject, *mdict, *version;
-  int found_major, found_minor, found_micro;
+  PyObject *gi, *gobject;
 
-  init_pygobject ();
+  /* import gobject */
+  pygobject_init (req_major, req_minor, req_micro);
+  if (PyErr_Occurred ())
+    {
+      g_warning ("Error initializing Python interpreter: could not "
+                 "import pygobject");
+
+      return;
+    }
 
-  gobject = PyImport_ImportModule ("gobject");
-  mdict = PyModule_GetDict (gobject);
-  version = PyDict_GetItemString (mdict, "pygobject_version");
-  if (!version)
+  gi = PyImport_ImportModule ("gi");
+  if (gi == NULL)
     {
-      PyErr_SetString (PyExc_ImportError, "PyGObject version too old");
+      g_warning ("Error initializing Python interpreter: could not "
+                 "import gi");
+
       return;
     }
-  if (!PyArg_ParseTuple
-      (version, "iii", &found_major, &found_minor, &found_micro))
-    return;
-  if (req_major != found_major || req_minor > found_minor ||
-      (req_minor == found_minor && req_micro > found_micro))
+
+  gobject = PyImport_ImportModule ("gi.repository.GObject");
+  if (gobject == NULL)
     {
-      PyErr_Format (PyExc_ImportError,
-                    "PyGObject version mismatch, %d.%d.%d is required, "
-                    "found %d.%d.%d.", req_major, req_minor, req_micro,
-                    found_major, found_minor, found_micro);
+      g_warning ("Error initializing Python interpreter: could not "
+                 "import gobject");
+
       return;
     }
 }



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