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.override | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 contrib/python/jsonglib.override (limited to 'contrib/python/jsonglib.override') diff --git a/contrib/python/jsonglib.override b/contrib/python/jsonglib.override new file mode 100644 index 0000000..121ea5a --- /dev/null +++ b/contrib/python/jsonglib.override @@ -0,0 +1,56 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- */ +%% +headers +#include +#include + +#define NO_IMPORT_PYGOBJECT +#include "pygobject.h" + +#include +#include + +static PyObject * +_helper_wrap_pointer_gslist (GType type, GSList *list) +{ + GSList *tmp; + PyObject *py_list; + + if ((py_list = PyList_New(0)) == NULL) { + return NULL; + } + for (tmp = list; tmp != NULL; tmp = tmp->next) { + PyObject *obj = pyg_pointer_new (type, tmp->data); + PyList_Append(py_list, obj); + Py_DECREF(obj); + } + return py_list; +} + +static PyObject * +_helper_wrap_string_gslist (GSList *list) +{ + GSList *tmp; + PyObject *py_list; + + if ((py_list = PyList_New(0)) == NULL) { + return NULL; + } + for (tmp = list; tmp != NULL; tmp = tmp->next) { + PyObject *str_obj = PyString_FromString ((char*)tmp->data); + + if (str_obj == NULL) { + Py_DECREF(py_list); + return NULL; + } + PyList_Append(py_list, str_obj); + Py_DECREF(str_obj); + } + return py_list; +} +%% +modulename json_glib +%% +import gobject.GObject as PyGObject_Type + + -- cgit v1.2.1