[pygobject] make the gi module compile under 3.x
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] make the gi module compile under 3.x
- Date: Wed, 25 Aug 2010 09:32:26 +0000 (UTC)
commit 427a3c8053feca35ccd746575760ac8a0ed50a12
Author: John (J5) Palmieri <johnp redhat com>
Date: Tue Aug 17 02:24:44 2010 -0400
make the gi module compile under 3.x
* include the compat macros
* use GLIB_MODULE_START/END to define module
* add PyInit__gi to the exported symbols
https://bugzilla.gnome.org/show_bug.cgi?id=615872
gi/Makefile.am | 2 +-
gi/gimodule.c | 24 +++++++++---------------
2 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/gi/Makefile.am b/gi/Makefile.am
index adad413..90cbf7d 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -22,7 +22,7 @@ _gi_la_CFLAGS = \
_gi_la_LDFLAGS = \
-module \
-avoid-version \
- -export-symbols-regex init_gi
+ -export-symbols-regex "init_gi|PyInit__gi"
_gi_la_LIBADD = \
$(GI_LIBS)
_gi_la_SOURCES = \
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 757a494..d9cc0f5 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -25,6 +25,7 @@
#include "pygi.h"
#include <pygobject.h>
+#include <pyglib-python-compat.h>
static PyObject *
_wrap_pyg_enum_add (PyObject *self,
@@ -234,7 +235,7 @@ _wrap_pyg_hook_up_vfunc_implementation (PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
-static PyMethodDef _pygi_functions[] = {
+static PyMethodDef _gi_functions[] = {
{ "enum_add", (PyCFunction) _wrap_pyg_enum_add, METH_VARARGS | METH_KEYWORDS },
{ "flags_add", (PyCFunction) _wrap_pyg_flags_add, METH_VARARGS | METH_KEYWORDS },
@@ -251,17 +252,10 @@ static struct PyGI_API CAPI = {
pygi_register_foreign_struct_real,
};
-PyMODINIT_FUNC
-init_gi (void)
+PYGLIB_MODULE_START(_gi, "_gi")
{
- PyObject *m;
PyObject *api;
- m = Py_InitModule ("_gi", _pygi_functions);
- if (m == NULL) {
- return;
- }
-
if (pygobject_init (-1, -1, -1) == NULL) {
return;
}
@@ -270,16 +264,16 @@ init_gi (void)
return;
}
- _pygi_repository_register_types (m);
- _pygi_info_register_types (m);
- _pygi_struct_register_types (m);
- _pygi_boxed_register_types (m);
+ _pygi_repository_register_types (module);
+ _pygi_info_register_types (module);
+ _pygi_struct_register_types (module);
+ _pygi_boxed_register_types (module);
_pygi_argument_init();
api = PyCObject_FromVoidPtr ( (void *) &CAPI, NULL);
if (api == NULL) {
return;
}
- PyModule_AddObject (m, "_API", api);
+ PyModule_AddObject (module, "_API", api);
}
-
+PYGLIB_MODULE_END
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]