Commit 427a3c80 authored by John (J5) Palmieri's avatar John (J5) Palmieri Committed by Tomeu Vizoso
Browse files

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
parent 1dee5dcd
......@@ -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 = \
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment