From 44cf8ec67278bd1ab6c7f83a9993f7a5686a9541 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 9 Mar 2024 01:06:44 +0100 Subject: Adding upstream version 0.23.93. Signed-off-by: Daniel Baumann --- pygtk/Makefile.am.inc | 24 ++++++++++++++++++++++++ pygtk/zbarpygtk.override | 20 ++++++++++++++++++++ pygtk/zbarpygtkmodule.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 pygtk/Makefile.am.inc create mode 100644 pygtk/zbarpygtk.override create mode 100644 pygtk/zbarpygtkmodule.c (limited to 'pygtk') diff --git a/pygtk/Makefile.am.inc b/pygtk/Makefile.am.inc new file mode 100644 index 0000000..033d601 --- /dev/null +++ b/pygtk/Makefile.am.inc @@ -0,0 +1,24 @@ +pyexec_LTLIBRARIES += pygtk/zbarpygtk.la +pygtk_zbarpygtk_la_CPPFLAGS = \ + $(GTK_CFLAGS) $(PYTHON_CFLAGS) $(PYGTK_CFLAGS) $(AM_CPPFLAGS) +pygtk_zbarpygtk_la_LDFLAGS = -shared -module -avoid-version -export-dynamic \ + -export-symbols-regex initzbarpygtk $(PYTHON_LDFLAGS) +pygtk_zbarpygtk_la_LIBADD = \ + $(PYGTK_LIBS) gtk/libzbargtk.la $(AM_LIBADD) + +pygtk_zbarpygtk_la_DEPENDENCIES = gtk/libzbargtk.la +dist_pygtk_zbarpygtk_la_SOURCES = pygtk/zbarpygtkmodule.c +nodist_pygtk_zbarpygtk_la_SOURCES = pygtk/zbarpygtk.c +BUILT_SOURCES += pygtk/zbarpygtk.c pygtk/zbarpygtk.defs +CLEANFILES += pygtk/zbarpygtk.c pygtk/zbarpygtk.defs +EXTRA_DIST += pygtk/zbarpygtk.override + +# FIXME ugly hack to fixup new name... now non-standard? +pygtk/zbarpygtk.defs: include/zbar/zbargtk.h + $(PYTHON) $(PYGTK_H2DEF) $< | \ + $(SED) -e 's/Z_TYPE_BAR_/ZBAR_TYPE_/' > $@ + +pygtk/%.c: pygtk/%.defs $(srcdir)/pygtk/zbarpygtk.override + $(PYGTK_CODEGEN) --prefix zbarpygtk \ + --register $(PYGTK_DEFS)/gdk-types.defs \ + --override $(srcdir)/pygtk/zbarpygtk.override $< > $@ diff --git a/pygtk/zbarpygtk.override b/pygtk/zbarpygtk.override new file mode 100644 index 0000000..a66ceb9 --- /dev/null +++ b/pygtk/zbarpygtk.override @@ -0,0 +1,20 @@ +%% +headers +#include +#include +#include +%% +modulename zbarpygtk +%% +import gtk.Widget as PyGtkWidget_Type +import gtk.gdk.Pixbuf as PyGdkPixbuf_Type +%% +ignore-type + ZBarGtkError +%% +ignore-glob + *_get_type +%% +ignore + zbar_gtk_image_from_pixbuf # until base library wrappers are in place +%% diff --git a/pygtk/zbarpygtkmodule.c b/pygtk/zbarpygtkmodule.c new file mode 100644 index 0000000..5e354e7 --- /dev/null +++ b/pygtk/zbarpygtkmodule.c @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------ + * Copyright 2008-2009 (c) Jeff Brown + * + * This file is part of the ZBar Bar Code Reader. + * + * The ZBar Bar Code Reader is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * The ZBar Bar Code Reader 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 Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with the ZBar Bar Code Reader; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * http://sourceforge.net/projects/zbar + *------------------------------------------------------------------------*/ + +/* avoid "multiple definition" darwin link errors + * for symbols defined in pygobject.h (bug #2052681) + */ +#define NO_IMPORT_PYGOBJECT + +#include + +void zbarpygtk_register_classes(PyObject *); +extern PyMethodDef zbarpygtk_functions[]; + +DL_EXPORT(void) +initzbarpygtk(void) +{ + init_pygobject(); + + PyObject *mod = Py_InitModule("zbarpygtk", zbarpygtk_functions); + PyObject *dict = PyModule_GetDict(mod); + + zbarpygtk_register_classes(dict); + + if (PyErr_Occurred()) + Py_FatalError("unable to initialise module zbarpygtk"); +} -- cgit v1.2.3