From e524e1ba62b67e9918f7a6a5be1131e126a54e1e Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Thu, 4 Jan 2007 18:55:38 +0000 Subject: * configure.ac gnome-autogen.sh bindings/python/Makefile.am docs/reference/libgpod-overrides.txt docs/reference/Makefile.am: fix make distcheck, minor automake cleanups. * bindings/python/gpod.i bindings/python/gpod.i.in: rename gpod.i -> gpod.i.in. it is now generated by autoconf. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1347 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- ChangeLog | 13 ++ bindings/python/Makefile.am | 45 +++--- bindings/python/gpod.i | 283 ----------------------------------- bindings/python/gpod.i.in | 283 +++++++++++++++++++++++++++++++++++ configure.ac | 1 + docs/reference/Makefile.am | 3 +- docs/reference/libgpod-overrides.txt | 0 gnome-autogen.sh | 2 +- 8 files changed, 322 insertions(+), 308 deletions(-) delete mode 100644 bindings/python/gpod.i create mode 100644 bindings/python/gpod.i.in create mode 100644 docs/reference/libgpod-overrides.txt diff --git a/ChangeLog b/ChangeLog index b56f078..6a3c776 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-01-04 Todd Zullinger + + * configure.ac + gnome-autogen.sh + bindings/python/Makefile.am + docs/reference/libgpod-overrides.txt + docs/reference/Makefile.am: fix make distcheck, minor automake + cleanups. + + * bindings/python/gpod.i + bindings/python/gpod.i.in: rename gpod.i -> gpod.i.in. it is now + generated by autoconf. + 2006-11-26 Jorg Schuler * src/ithumb-writer.c (ithumb_writer_write_thumbnail): handle diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am index abce2d1..9373edc 100644 --- a/bindings/python/Makefile.am +++ b/bindings/python/Makefile.am @@ -1,35 +1,36 @@ SUBDIRS = examples -EXTRA_DIST = \ - gpod.i \ - ipod.py \ - __init__.py \ - gtkpod.py - -CLEANFILES = \ - *.pyc \ - *.pyo \ - _gpod.so \ - gpod.py \ - gpod_wrap.c \ - gpod_wrap.o - -MAINTAINERCLEANFILES = \ - README +EXTRA_DIST = \ + README.in \ + __init__.py \ + gpod.i.in \ + gtkpod.py \ + ipod.py + +CLEANFILES = \ + *.pyc \ + *.pyo \ + _gpod.so \ + gpod.py \ + gpod_wrap.* + +DISTCLEANFILES = \ + README \ + gpod.i if HAVE_PYTHON -MODULE_CFLAGS = `$(PKG_CONFIG) --cflags $(top_srcdir)/libgpod-1.0.pc` $(PYTHON_INCLUDES) -MODULE_LIBS = `$(PKG_CONFIG) --libs $(top_srcdir)/libgpod-1.0.pc` -L$(top_srcdir)/src/.libs -python_DATA = gpod.py _gpod.so +MODULE_CFLAGS = `$(PKG_CONFIG) --cflags $(top_builddir)/libgpod-1.0.pc` $(PYTHON_INCLUDES) +MODULE_LIBS = `$(PKG_CONFIG) --libs $(top_builddir)/libgpod-1.0.pc` -L$(top_srcdir)/src/.libs +python_DATA = gpod.py _gpod.so gpod_wrap.c: gpod.i - $(SWIG) -python gpod.i + $(SWIG) -python -o $@ gpod.i gpod.py: gpod.i - $(SWIG) -python gpod.i + $(SWIG) -python -o $@ gpod.i gpod_wrap.o: gpod_wrap.c - $(CC) $(MODULE_CFLAGS) -c -fpic gpod_wrap.c + $(CC) -I$(top_srcdir)/src $(MODULE_CFLAGS) -c -fpic gpod_wrap.c _gpod.so: gpod_wrap.o $(CC) $(MODULE_LIBS) @PYTHON_LDFLAGS@ gpod_wrap.o -o $@ diff --git a/bindings/python/gpod.i b/bindings/python/gpod.i deleted file mode 100644 index 472f9d9..0000000 --- a/bindings/python/gpod.i +++ /dev/null @@ -1,283 +0,0 @@ -/* File : gpod.i */ - -/* - Copyright (C) 2005 Nick Piper - Part of the gtkpod project. - - URL: http://www.gtkpod.org/ - URL: http://gtkpod.sourceforge.net/ - - The code contained in this file is free software; you can redistribute - it and/or modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either version - 2.1 of the License, or (at your option) any later version. - - This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this code; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - $Id$ - -Please send any fixes, improvements or suggestions to -. - -*/ - -%module gpod -%{ -#include "../../src/db-artwork-debug.h" -#include "../../src/db-artwork-parser.h" -#include "../../src/db-image-parser.h" -#include "../../src/db-itunes-parser.h" -#include "../../src/db-parse-context.h" -#include "../../src/itdb.h" -#include "../../src/itdb_private.h" - -PyObject* sw_get_tracks(Itdb_iTunesDB *itdb) { - PyObject *list; - gint i; - GList *l; - list = PyList_New(g_list_length(itdb->tracks)); - for (l = itdb->tracks, i = 0; l; l = l->next, ++i) { - PyList_SET_ITEM(list, i, SWIG_NewPointerObj((void*)(l->data), SWIGTYPE_p__Itdb_Track, 0)); - } - return list; - } - -PyObject* sw_get_track(GList *list, gint index) { - GList *position; - if ( (index >= g_list_length(list)) || index < 0 ) { - PyErr_SetString(PyExc_IndexError, "Value out of range"); - return NULL; - } - position = g_list_nth(list, index); - return SWIG_NewPointerObj((void*)(position->data), SWIGTYPE_p__Itdb_Track, 0); - } - -PyObject* sw_get_rule(GList *list, gint index) { - GList *position; - if ( (index >= g_list_length(list)) || index < 0 ) { - PyErr_SetString(PyExc_IndexError, "Value out of range"); - return NULL; - } - position = g_list_nth(list, index); - return SWIG_NewPointerObj((void*)(position->data), SWIGTYPE_p__SPLRule, 0); - } - -PyObject* sw_get_playlist(GList *list, gint index) { - GList *position; - if ( (index >= g_list_length(list)) || index < 0 ) { - PyErr_SetString(PyExc_IndexError, "Value out of range"); - return NULL; - } - position = g_list_nth(list, index); - return SWIG_NewPointerObj((void*)(position->data), SWIGTYPE_p__Itdb_Playlist, 0); - } - -PyObject* sw_get_list_len(GList *list) { - return PyInt_FromLong(g_list_length(list)); - } - -PyObject* sw_get_playlist_tracks(Itdb_Playlist *pl) { - PyObject *list; - gint i; - GList *l; - list = PyList_New(g_list_length(pl->members)); - for (l = pl->members, i = 0; l; l = l->next, ++i) { - PyList_SET_ITEM(list, i, SWIG_NewPointerObj((void*)(l->data), SWIGTYPE_p__Itdb_Track, 0)); - } - return list; - } - -PyObject* sw_get_playlists(Itdb_iTunesDB *itdb) { - PyObject *list; - gint i; - GList *l; - list = PyList_New(g_list_length(itdb->playlists)); - for (l = itdb->playlists, i = 0; l; l = l->next, ++i) { - PyList_SET_ITEM(list, i, SWIG_NewPointerObj((void*)(l->data), SWIGTYPE_p__Itdb_Playlist, 0)); - } - return list; - } - - void sw__track_extra_destroy (PyObject *data) { - Py_XDECREF(data); - } - - PyObject *sw__track_extra_duplicate (PyObject *data) { - if (data == Py_None) { - Py_INCREF(Py_None); - return Py_None; - } else { - return PyDict_Copy(data); - } - } - - PyObject *sw_set_track_userdata(Itdb_Track *track, PyObject *data) { - Py_INCREF(data); - if ((PyDict_Check(data)) || (data == Py_None)) { - if (track->userdata) { - Py_DECREF((PyObject *)track->userdata); - } - track->userdata = (gpointer) data; - track->userdata_duplicate = (ItdbUserDataDuplicateFunc)sw__track_extra_duplicate; - track->userdata_destroy = (ItdbUserDataDestroyFunc)sw__track_extra_destroy; - Py_INCREF(Py_None); - return Py_None; - } else { - PyErr_SetString(PyExc_TypeError, "userdata must be a Dictionary"); - return NULL; - } - } - - PyObject* sw_get_track_userdata(Itdb_Track *track) { - if (track->userdata) { - Py_INCREF((PyObject *)track->userdata); - return (PyObject *)track->userdata; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - - -%} - -# be nicer to decode these utf8 strings into Unicode objects in the C -# layer. Here we are leaving it to the Python side, and just giving -# them utf8 encoded Strings. -typedef char gchar; - - -%typemap(in) guint8 { - unsigned long ival; - ival = PyInt_AsUnsignedLongMask($input); - if (PyErr_Occurred()) - SWIG_fail; - if (ival > 255) { - PyErr_SetString(PyExc_ValueError, "$symname: Value must be between 0 and 255"); - SWIG_fail; - } else { - $1 = (guint8) ival; - } -} - -%typemap(in) gint8 { - long ival; - ival = PyInt_AsInt($input); - if (PyErr_Occurred()) - SWIG_fail; - if ((ival < -128) || (ival > 127)) { - PyErr_SetString(PyExc_ValueError, "$symname: Value must be between -128 and 127"); - SWIG_fail; - } else { - $1 = (gint8) ival; - } -} - -%typemap(in) guint16 { - unsigned long ival; - ival = PyInt_AsUnsignedLongMask($input); - if (PyErr_Occurred()) - SWIG_fail; - if (ival > 65535) { - PyErr_SetString(PyExc_ValueError, "$symname: Value must be between 0 and 65535"); - SWIG_fail; - } else { - $1 = (guint16) ival; - } -} - -%typemap(in) gint16 { - long ival; - ival = PyInt_AsLong($input); - if (PyErr_Occurred()) - SWIG_fail; - if ((ival < -32768) || (ival > 32767)) { - PyErr_SetString(PyExc_ValueError, "$symname: Value must be between -32,768 and 32,767"); - SWIG_fail; - } else { - $1 = (gint16) ival; - } -} - -%typemap(in) guint32 { - unsigned long ival; - ival = PyInt_AsUnsignedLongMask($input); - if (PyErr_Occurred()) - SWIG_fail; - $1 = (guint32) ival; -} - -%typemap(in) gint32 { - long ival; - ival = PyInt_AsLong($input); - if (PyErr_Occurred()) - SWIG_fail; - $1 = (gint32) ival; -} - -%typemap(in) guint64 { - if (PyInt_CheckExact($input)) - $1 = PyInt_AsUnsignedLongLongMask($input); - else - $1 = PyLong_AsUnsignedLongLong($input); - if (PyErr_Occurred()) - SWIG_fail; -} - -%typemap(in) gint64 { - if (PyInt_CheckExact($input)) - $1 = PyInt_AsLong($input); - else - $1 = PyLong_AsLongLong($input); - if (PyErr_Occurred()) - SWIG_fail; -} - -%typemap(out) guint64 { - $result = PyLong_FromUnsignedLongLong($1); -} - -%typemap(out) gint64 { - $result = PyLong_FromLongLong($1); -} - -%typemap(out) guint32 { - $result = PyLong_FromUnsignedLong($1); -} - -%typemap(out) gint32 { - $result = PyLong_FromLong($1); -} - -%typemap(out) guint16 { - $result = PyLong_FromUnsignedLong($1); -} - -%typemap(out) guint8 { - $result = PyInt_FromLong($1); -} - -typedef int gboolean; -typedef int gint; - -#define G_BEGIN_DECLS -#define G_END_DECLS - -PyObject* sw_get_tracks(Itdb_iTunesDB *itdb); -PyObject* sw_get_track(GList *list, gint index); -PyObject* sw_get_rule(GList *list, gint index); -PyObject* sw_get_playlist(GList *list, gint index); -PyObject* sw_get_list_len(GList *list); -PyObject* sw_get_playlists(Itdb_iTunesDB *itdb); -PyObject* sw_get_playlist_tracks(Itdb_Playlist *pl); -PyObject* sw_set_track_userdata(Itdb_Track *track, PyObject *data); -PyObject* sw_get_track_userdata(Itdb_Track *track); - -%include "../../src/itdb.h" diff --git a/bindings/python/gpod.i.in b/bindings/python/gpod.i.in new file mode 100644 index 0000000..90de899 --- /dev/null +++ b/bindings/python/gpod.i.in @@ -0,0 +1,283 @@ +/* File : gpod.i.in */ + +/* + Copyright (C) 2005 Nick Piper + Part of the gtkpod project. + + URL: http://www.gtkpod.org/ + URL: http://gtkpod.sourceforge.net/ + + The code contained in this file is free software; you can redistribute + it and/or modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either version + 2.1 of the License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this code; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + $Id$ + +Please send any fixes, improvements or suggestions to +. + +*/ + +%module gpod +%{ +#include "db-artwork-debug.h" +#include "db-artwork-parser.h" +#include "db-image-parser.h" +#include "db-itunes-parser.h" +#include "db-parse-context.h" +#include "itdb.h" +#include "itdb_private.h" + +PyObject* sw_get_tracks(Itdb_iTunesDB *itdb) { + PyObject *list; + gint i; + GList *l; + list = PyList_New(g_list_length(itdb->tracks)); + for (l = itdb->tracks, i = 0; l; l = l->next, ++i) { + PyList_SET_ITEM(list, i, SWIG_NewPointerObj((void*)(l->data), SWIGTYPE_p__Itdb_Track, 0)); + } + return list; + } + +PyObject* sw_get_track(GList *list, gint index) { + GList *position; + if ( (index >= g_list_length(list)) || index < 0 ) { + PyErr_SetString(PyExc_IndexError, "Value out of range"); + return NULL; + } + position = g_list_nth(list, index); + return SWIG_NewPointerObj((void*)(position->data), SWIGTYPE_p__Itdb_Track, 0); + } + +PyObject* sw_get_rule(GList *list, gint index) { + GList *position; + if ( (index >= g_list_length(list)) || index < 0 ) { + PyErr_SetString(PyExc_IndexError, "Value out of range"); + return NULL; + } + position = g_list_nth(list, index); + return SWIG_NewPointerObj((void*)(position->data), SWIGTYPE_p__SPLRule, 0); + } + +PyObject* sw_get_playlist(GList *list, gint index) { + GList *position; + if ( (index >= g_list_length(list)) || index < 0 ) { + PyErr_SetString(PyExc_IndexError, "Value out of range"); + return NULL; + } + position = g_list_nth(list, index); + return SWIG_NewPointerObj((void*)(position->data), SWIGTYPE_p__Itdb_Playlist, 0); + } + +PyObject* sw_get_list_len(GList *list) { + return PyInt_FromLong(g_list_length(list)); + } + +PyObject* sw_get_playlist_tracks(Itdb_Playlist *pl) { + PyObject *list; + gint i; + GList *l; + list = PyList_New(g_list_length(pl->members)); + for (l = pl->members, i = 0; l; l = l->next, ++i) { + PyList_SET_ITEM(list, i, SWIG_NewPointerObj((void*)(l->data), SWIGTYPE_p__Itdb_Track, 0)); + } + return list; + } + +PyObject* sw_get_playlists(Itdb_iTunesDB *itdb) { + PyObject *list; + gint i; + GList *l; + list = PyList_New(g_list_length(itdb->playlists)); + for (l = itdb->playlists, i = 0; l; l = l->next, ++i) { + PyList_SET_ITEM(list, i, SWIG_NewPointerObj((void*)(l->data), SWIGTYPE_p__Itdb_Playlist, 0)); + } + return list; + } + + void sw__track_extra_destroy (PyObject *data) { + Py_XDECREF(data); + } + + PyObject *sw__track_extra_duplicate (PyObject *data) { + if (data == Py_None) { + Py_INCREF(Py_None); + return Py_None; + } else { + return PyDict_Copy(data); + } + } + + PyObject *sw_set_track_userdata(Itdb_Track *track, PyObject *data) { + Py_INCREF(data); + if ((PyDict_Check(data)) || (data == Py_None)) { + if (track->userdata) { + Py_DECREF((PyObject *)track->userdata); + } + track->userdata = (gpointer) data; + track->userdata_duplicate = (ItdbUserDataDuplicateFunc)sw__track_extra_duplicate; + track->userdata_destroy = (ItdbUserDataDestroyFunc)sw__track_extra_destroy; + Py_INCREF(Py_None); + return Py_None; + } else { + PyErr_SetString(PyExc_TypeError, "userdata must be a Dictionary"); + return NULL; + } + } + + PyObject* sw_get_track_userdata(Itdb_Track *track) { + if (track->userdata) { + Py_INCREF((PyObject *)track->userdata); + return (PyObject *)track->userdata; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + + +%} + +# be nicer to decode these utf8 strings into Unicode objects in the C +# layer. Here we are leaving it to the Python side, and just giving +# them utf8 encoded Strings. +typedef char gchar; + + +%typemap(in) guint8 { + unsigned long ival; + ival = PyInt_AsUnsignedLongMask($input); + if (PyErr_Occurred()) + SWIG_fail; + if (ival > 255) { + PyErr_SetString(PyExc_ValueError, "$symname: Value must be between 0 and 255"); + SWIG_fail; + } else { + $1 = (guint8) ival; + } +} + +%typemap(in) gint8 { + long ival; + ival = PyInt_AsInt($input); + if (PyErr_Occurred()) + SWIG_fail; + if ((ival < -128) || (ival > 127)) { + PyErr_SetString(PyExc_ValueError, "$symname: Value must be between -128 and 127"); + SWIG_fail; + } else { + $1 = (gint8) ival; + } +} + +%typemap(in) guint16 { + unsigned long ival; + ival = PyInt_AsUnsignedLongMask($input); + if (PyErr_Occurred()) + SWIG_fail; + if (ival > 65535) { + PyErr_SetString(PyExc_ValueError, "$symname: Value must be between 0 and 65535"); + SWIG_fail; + } else { + $1 = (guint16) ival; + } +} + +%typemap(in) gint16 { + long ival; + ival = PyInt_AsLong($input); + if (PyErr_Occurred()) + SWIG_fail; + if ((ival < -32768) || (ival > 32767)) { + PyErr_SetString(PyExc_ValueError, "$symname: Value must be between -32,768 and 32,767"); + SWIG_fail; + } else { + $1 = (gint16) ival; + } +} + +%typemap(in) guint32 { + unsigned long ival; + ival = PyInt_AsUnsignedLongMask($input); + if (PyErr_Occurred()) + SWIG_fail; + $1 = (guint32) ival; +} + +%typemap(in) gint32 { + long ival; + ival = PyInt_AsLong($input); + if (PyErr_Occurred()) + SWIG_fail; + $1 = (gint32) ival; +} + +%typemap(in) guint64 { + if (PyInt_CheckExact($input)) + $1 = PyInt_AsUnsignedLongLongMask($input); + else + $1 = PyLong_AsUnsignedLongLong($input); + if (PyErr_Occurred()) + SWIG_fail; +} + +%typemap(in) gint64 { + if (PyInt_CheckExact($input)) + $1 = PyInt_AsLong($input); + else + $1 = PyLong_AsLongLong($input); + if (PyErr_Occurred()) + SWIG_fail; +} + +%typemap(out) guint64 { + $result = PyLong_FromUnsignedLongLong($1); +} + +%typemap(out) gint64 { + $result = PyLong_FromLongLong($1); +} + +%typemap(out) guint32 { + $result = PyLong_FromUnsignedLong($1); +} + +%typemap(out) gint32 { + $result = PyLong_FromLong($1); +} + +%typemap(out) guint16 { + $result = PyLong_FromUnsignedLong($1); +} + +%typemap(out) guint8 { + $result = PyInt_FromLong($1); +} + +typedef int gboolean; +typedef int gint; + +#define G_BEGIN_DECLS +#define G_END_DECLS + +PyObject* sw_get_tracks(Itdb_iTunesDB *itdb); +PyObject* sw_get_track(GList *list, gint index); +PyObject* sw_get_rule(GList *list, gint index); +PyObject* sw_get_playlist(GList *list, gint index); +PyObject* sw_get_list_len(GList *list); +PyObject* sw_get_playlists(Itdb_iTunesDB *itdb); +PyObject* sw_get_playlist_tracks(Itdb_Playlist *pl); +PyObject* sw_set_track_userdata(Itdb_Track *track, PyObject *data); +PyObject* sw_get_track_userdata(Itdb_Track *track); + +%include "@top_srcdir@/src/itdb.h" diff --git a/configure.ac b/configure.ac index c010c58..6f91045 100644 --- a/configure.ac +++ b/configure.ac @@ -161,6 +161,7 @@ AC_SUBST(LIBGPOD_LIBS) AC_OUTPUT([ Makefile bindings/Makefile +bindings/python/gpod.i bindings/python/Makefile bindings/python/examples/Makefile docs/Makefile diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index 138d70a..0ce396d 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -74,5 +74,4 @@ GTKDOC_LIBS= include $(top_srcdir)/gtk-doc.make # Other files to distribute -# e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST += +EXTRA_DIST += version.xml.in diff --git a/docs/reference/libgpod-overrides.txt b/docs/reference/libgpod-overrides.txt new file mode 100644 index 0000000..e69de29 diff --git a/gnome-autogen.sh b/gnome-autogen.sh index 58ab007..f6bd367 100755 --- a/gnome-autogen.sh +++ b/gnome-autogen.sh @@ -457,7 +457,7 @@ for configure_ac in $configure_files; do fi done -conf_flags="--enable-maintainer-mode" +conf_flags="--enable-maintainer-mode --enable-gtk-doc" if test x$NOCONFIGURE = x; then printbold Running $srcdir/configure $conf_flags "$@" ... -- cgit