From 0353f99f9b26aeedd0f23eebf75ddab84794c4a2 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 5 Mar 2008 09:52:10 +0000 Subject: Fix compilation issues of the JSON-GLib Python bindings Apparently, if you have a dash in the module name defs files the Python code generation script goes bang and produces invalid C files. --- contrib/python/jsonglib-module.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 contrib/python/jsonglib-module.c (limited to 'contrib/python/jsonglib-module.c') diff --git a/contrib/python/jsonglib-module.c b/contrib/python/jsonglib-module.c new file mode 100644 index 0000000..81109a2 --- /dev/null +++ b/contrib/python/jsonglib-module.c @@ -0,0 +1,33 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* include this first, before NO_IMPORT_PYGOBJECT is defined */ +#include + +/* include any extra headers needed here */ +#include + +void pyjsonglib_register_classes(PyObject *d); +void pyjsonglib_add_constants(PyObject *module, const gchar *strip_prefix); +extern PyMethodDef pyjsonglib_functions[]; + +DL_EXPORT(void) +initjsonglib(void) +{ + PyObject *m, *d; + + /* perform any initialisation required by the library here */ + init_pygobject(); + + m = Py_InitModule("json_glib", pyjsonglib_functions); + d = PyModule_GetDict(m); + + /* add anything else to the module dictionary (such as constants) */ + pyjsonglib_register_classes(d); + pyjsonglib_add_constants(m, "JSON_"); + + if (PyErr_Occurred()) + Py_FatalError("could not initialise module json_glib"); +} -- cgit v1.2.1