diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | acinclude.m4 | 66 | ||||
-rw-r--r-- | configure.ac | 21 | ||||
-rw-r--r-- | python/Makefile.am | 37 | ||||
-rw-r--r-- | python/bad__init__.py | 11 | ||||
-rw-r--r-- | python/demo.py | 7 | ||||
-rw-r--r-- | python/mateweather.defs | 326 | ||||
-rw-r--r-- | python/mateweather.override | 104 | ||||
-rw-r--r-- | python/mateweathermodule.c | 44 |
9 files changed, 1 insertions, 617 deletions
diff --git a/Makefile.am b/Makefile.am index 7eb1157..325b0a7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = po po-locations libmateweather doc data python icons +SUBDIRS = po po-locations libmateweather doc data icons ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} diff --git a/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index fe90156..0000000 --- a/acinclude.m4 +++ /dev/null @@ -1,66 +0,0 @@ -## this one is commonly used with AM_PATH_PYTHONDIR ... -dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]]) -dnl Check if a module containing a given symbol is visible to python. -AC_DEFUN([AM_CHECK_PYMOD], -[AC_REQUIRE([AM_PATH_PYTHON]) -py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` -AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1) -AC_CACHE_VAL(py_cv_mod_$py_mod_var, [ -ifelse([$2],[], [prog=" -import sys -try: - import $1 -except ImportError: - sys.exit(1) -except: - sys.exit(0) -sys.exit(0)"], [prog=" -import $1 -$1.$2"]) -if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC - then - eval "py_cv_mod_$py_mod_var=yes" - else - eval "py_cv_mod_$py_mod_var=no" - fi -]) -py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"` -if test "x$py_val" != xno; then - AC_MSG_RESULT(yes) - ifelse([$3], [],, [$3 -])dnl -else - AC_MSG_RESULT(no) - ifelse([$4], [],, [$4 -])dnl -fi -]) - -dnl a macro to check for ability to create python extensions -dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) -dnl function also defines PYTHON_INCLUDES -AC_DEFUN([AM_CHECK_PYTHON_HEADERS], -[AC_REQUIRE([AM_PATH_PYTHON]) -AC_MSG_CHECKING(for headers required to compile python extensions) -dnl deduce PYTHON_INCLUDES -py_prefix=`$PYTHON -c "import sys; print sys.prefix"` -py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` -if test -x "$PYTHON-config"; then -PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` -else -PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" -if test "$py_prefix" != "$py_exec_prefix"; then - PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" -fi -fi -AC_SUBST(PYTHON_INCLUDES) -dnl check if the headers exist: -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" -AC_TRY_CPP([#include <Python.h>],dnl -[AC_MSG_RESULT(found) -$1],dnl -[AC_MSG_RESULT(not found) -$2]) -CPPFLAGS="$save_CPPFLAGS" -]) diff --git a/configure.ac b/configure.ac index 64e5609..9bcb32e 100644 --- a/configure.ac +++ b/configure.ac @@ -167,24 +167,6 @@ fi AC_DEFINE_UNQUOTED(ZONEINFO_DIR, "$ZONEINFO_DIR", [zoneinfo directory]) dnl *************************************************************************** -dnl *** Python bindings -dnl *************************************************************************** -AC_ARG_ENABLE(python, - [AC_HELP_STRING([--enable-python], - [Build libmateweather python bindings])], - [enable_python=$enableval], - [enable_python=no]) -if test "$enable_python" = "yes"; then - AM_PATH_PYTHON() - AM_CHECK_PYTHON_HEADERS(,enable_python=no) - PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0) - pygtk_defsdir=`$PKG_CONFIG --variable=defsdir pygtk-2.0` - PYGTK_DEFS="$pygtk_defsdir/gtk.defs" - AC_SUBST(PYGTK_DEFS) -fi -AM_CONDITIONAL(BUILD_PYTHON, test "x$enable_python" = "xyes") - -dnl *************************************************************************** dnl *** Honour aclocal flags *** dnl *************************************************************************** ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}" @@ -194,7 +176,6 @@ AC_SUBST(VERSION) AC_SUBST(PACKAGE) AC_SUBST(DATADIR) AC_SUBST(LIBDIR) -AC_SUBST(PYTHONDIR) AC_SUBST(GLADEDIR) ################################################## @@ -215,7 +196,6 @@ libmateweather/mateweather.pc libmateweather/mateweather-uninstalled.pc libmateweather/org.mate.weather.gschema.xml data/Makefile -python/Makefile icons/Makefile ]) AC_OUTPUT @@ -234,7 +214,6 @@ libmateweather-$VERSION configure summary: Prefix: ${prefix} Source code location: ${srcdir} Compiler: ${CC} - Python bindings: ${enable_python} Locations.xml translations: ${LOCATIONS_XML_TRANSLATIONS} Locations.xml compression: ${enable_locations_compression} Gtk+ version: ${GTK_API_VERSION} diff --git a/python/Makefile.am b/python/Makefile.am deleted file mode 100644 index e31af06..0000000 --- a/python/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -if BUILD_PYTHON -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(PYTHON_INCLUDES) \ - $(PYGOBJECT_CFLAGS) \ - $(GTK_CFLAGS) - -pyunstabledir = $(pyexecdir)/mateweather/I_KNOW_THIS_IS_UNSTABLE -pyunstable_LTLIBRARIES = mateweather.la -mateweather_la_LDFLAGS = -module -avoid-version -export-symbols-regex initmateweather -mateweather_la_LIBADD = ../libmateweather/libmateweather.la -mateweather_la_SOURCES = mateweathermodule.c -nodist_mateweather_la_SOURCES = mateweather.c -mateweather.c: mateweather.defs mateweather.override - -.defs.c: - $(AM_V_GEN)(cd $(srcdir)\ - && pygobject-codegen-2.0 \ - --register $(PYGTK_DEFS) \ - --override $*.override \ - --prefix py$* $*.defs) > gen-$*.c \ - && cp gen-$*.c $*.c \ - && rm -f gen-$*.c - -install-exec-hook: - $(MKDIR_P) "$(DESTDIR)$(pyunstabledir)" - $(INSTALL_DATA) $(srcdir)/bad__init__.py "$(DESTDIR)$(pyexecdir)/mateweather/__init__.py" - touch $(DESTDIR)$(pyunstabledir)/__init__.py - chmod a+x $(DESTDIR)$(pyunstabledir)/__init__.py - -endif - -EXTRA_DIST = mateweather.defs mateweather.override bad__init__.py demo.py - -CLEANFILES = mateweather.c - --include $(top_srcdir)/git.mk diff --git a/python/bad__init__.py b/python/bad__init__.py deleted file mode 100644 index 11a6970..0000000 --- a/python/bad__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# The correct idiom is -# from mateweather.I_KNOW_THIS_IS_UNSTABLE import mateweather - -def location_new_world(use_regions): - raise ImportError("libmateweather should only be used if you understand that it's subject to change, and is not supported as a fixed API/ABI or as part of the platform") - -def location_entry_new(top): - raise ImportError("libmateweather should only be used if you understand that it's subject to change, and is not supported as a fixed API/ABI or as part of the platform") - -def timezone_menu_new(top): - raise ImportError("libmateweather should only be used if you understand that it's subject to change, and is not supported as a fixed API/ABI or as part of the platform") diff --git a/python/demo.py b/python/demo.py deleted file mode 100644 index 4ecb0f1..0000000 --- a/python/demo.py +++ /dev/null @@ -1,7 +0,0 @@ -from mateweather.I_KNOW_THIS_IS_UNSTABLE import mateweather - -for loc in mateweather.location_new_world(False).get_children(): - print loc.get_name() - for zone in loc.get_timezones(): - if zone.get_name() is not None: - print " %s" % zone.get_name() diff --git a/python/mateweather.defs b/python/mateweather.defs deleted file mode 100644 index bfbf24a..0000000 --- a/python/mateweather.defs +++ /dev/null @@ -1,326 +0,0 @@ -;; -*- scheme -*- -; boxed definitions ... - -(define-boxed Location - (in-module "MateWeather") - (c-name "MateWeatherLocation") - (gtype-id "MATEWEATHER_TYPE_LOCATION") -) - -(define-boxed Timezone - (in-module "MateWeather") - (c-name "MateWeatherTimezone") - (gtype-id "MATEWEATHER_TYPE_TIMEZONE") -) - -; interface definitions ... - -; object definitions ... - -(define-object LocationEntry - (in-module "MateWeather") - (parent "GtkEntry") - (c-name "MateWeatherLocationEntry") - (gtype-id "MATEWEATHER_TYPE_LOCATION_ENTRY") -) - -(define-object TimezoneMenu - (in-module "MateWeather") - (parent "GtkComboBox") - (c-name "MateWeatherTimezoneMenu") - (gtype-id "MATEWEATHER_TYPE_TIMEZONE_MENU") -) - -; pointer definitions ... - -;; Enumerations and Flags ... - -(define-enum LocationLevel - (in-module "MateWeather") - (c-name "MateWeatherLocationLevel") - (gtype-id "MATEWEATHER_TYPE_LOCATION_LEVEL") - (values - '("world" "MATEWEATHER_LOCATION_WORLD") - '("region" "MATEWEATHER_LOCATION_REGION") - '("country" "MATEWEATHER_LOCATION_COUNTRY") - '("adm1" "MATEWEATHER_LOCATION_ADM1") - '("adm2" "MATEWEATHER_LOCATION_ADM2") - '("city" "MATEWEATHER_LOCATION_CITY") - '("weather-station" "MATEWEATHER_LOCATION_WEATHER_STATION") - ) -) - - -;; From mateweather-enum-types.h - -(define-function g_weather_location_level_get_type - (c-name "g_weather_location_level_get_type") - (return-type "GType") -) - - - -;; From mateweather-location.h - -(define-function location_get_type - (c-name "mateweather_location_get_type") - (return-type "GType") -) - -(define-function location_new_world - (c-name "mateweather_location_new_world") - (return-type "MateWeatherLocation*") - (parameters - '("gboolean" "use_regions") - ) -) - -(define-method ref - (of-object "MateWeatherLocation") - (c-name "mateweather_location_ref") - (return-type "MateWeatherLocation*") -) - -(define-method unref - (of-object "MateWeatherLocation") - (c-name "mateweather_location_unref") - (return-type "none") -) - -(define-method get_name - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_name") - (return-type "const-char*") -) - -(define-method get_sort_name - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_sort_name") - (return-type "const-char*") -) - -(define-method get_level - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_level") - (return-type "MateWeatherLocationLevel") -) - -(define-method get_parent - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_parent") - (return-type "MateWeatherLocation*") -) - -(define-method get_children - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_children") - (return-type "MateWeatherLocation**") -) - -(define-method free_children - (of-object "MateWeatherLocation") - (c-name "mateweather_location_free_children") - (return-type "none") - (parameters - '("MateWeatherLocation**" "children") - ) -) - -(define-method has_coords - (of-object "MateWeatherLocation") - (c-name "mateweather_location_has_coords") - (return-type "gboolean") -) - -(define-method get_coords - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_coords") - (return-type "none") - (parameters - '("double*" "latitude") - '("double*" "longitude") - ) -) - -(define-method get_distance - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_distance") - (return-type "double") - (parameters - '("MateWeatherLocation*" "loc2") - ) -) - -(define-method get_country - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_country") - (return-type "const-char*") -) - -(define-method get_timezone - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_timezone") - (return-type "MateWeatherTimezone*") -) - -(define-method get_timezones - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_timezones") - (return-type "MateWeatherTimezone**") -) - -(define-method free_timezones - (of-object "MateWeatherLocation") - (c-name "mateweather_location_free_timezones") - (return-type "none") - (parameters - '("MateWeatherTimezone**" "zones") - ) -) - -(define-method get_code - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_code") - (return-type "const-char*") -) - -(define-method get_city_name - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_city_name") - (return-type "char*") -) - -(define-method get_weather - (of-object "MateWeatherLocation") - (c-name "mateweather_location_get_weather") - (return-type "WeatherInfo*") -) - - - -;; From mateweather-timezone.h - -(define-function timezone_get_type - (c-name "mateweather_timezone_get_type") - (return-type "GType") -) - -(define-method get_name - (of-object "MateWeatherTimezone") - (c-name "mateweather_timezone_get_name") - (return-type "const-char*") -) - -(define-method get_tzid - (of-object "MateWeatherTimezone") - (c-name "mateweather_timezone_get_tzid") - (return-type "const-char*") -) - -(define-method get_offset - (of-object "MateWeatherTimezone") - (c-name "mateweather_timezone_get_offset") - (return-type "int") -) - -(define-method has_dst - (of-object "MateWeatherTimezone") - (c-name "mateweather_timezone_has_dst") - (return-type "gboolean") -) - -(define-method get_dst_offset - (of-object "MateWeatherTimezone") - (c-name "mateweather_timezone_get_dst_offset") - (return-type "int") -) - -(define-method ref - (of-object "MateWeatherTimezone") - (c-name "mateweather_timezone_ref") - (return-type "MateWeatherTimezone*") -) - -(define-method unref - (of-object "MateWeatherTimezone") - (c-name "mateweather_timezone_unref") - (return-type "none") -) - - - -;; From location-entry.h - -(define-function location_entry_get_type - (c-name "mateweather_location_entry_get_type") - (return-type "GType") -) - -(define-function location_entry_new - (c-name "mateweather_location_entry_new") - (is-constructor-of "MateWeatherLocationEntry") - (return-type "GtkWidget*") - (properties - '("top") - ) -) - -(define-method set_location - (of-object "MateWeatherLocationEntry") - (c-name "mateweather_location_entry_set_location") - (return-type "none") - (parameters - '("MateWeatherLocation*" "loc") - ) -) - -(define-method get_location - (of-object "MateWeatherLocationEntry") - (c-name "mateweather_location_entry_get_location") - (return-type "MateWeatherLocation*") -) - -(define-method set_city - (of-object "MateWeatherLocationEntry") - (c-name "mateweather_location_entry_set_city") - (return-type "none") - (parameters - '("const-char*" "city_name") - '("const-char*" "code") - ) -) - - - -;; From timezone-menu.h - -(define-function timezone_menu_get_type - (c-name "mateweather_timezone_menu_get_type") - (return-type "GType") -) - -(define-function timezone_menu_new - (c-name "mateweather_timezone_menu_new") - (is-constructor-of "MateWeatherTimezoneMenu") - (return-type "GtkWidget*") - (properties - '("top") - ) -) - -(define-method set_tzid - (of-object "MateWeatherTimezoneMenu") - (c-name "mateweather_timezone_menu_set_tzid") - (return-type "none") - (parameters - '("const-char*" "tzid") - ) -) - -(define-method get_tzid - (of-object "MateWeatherTimezoneMenu") - (c-name "mateweather_timezone_menu_get_tzid") - (return-type "const-char*") -) - - diff --git a/python/mateweather.override b/python/mateweather.override deleted file mode 100644 index 16ce1e0..0000000 --- a/python/mateweather.override +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * - * mateweather.override: overrides for mateweather - */ -%% -headers -#define NO_IMPORT_PYGOBJECT -#include "pygobject.h" - -#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE -#include <libmateweather/mateweather-location.h> -#include <libmateweather/mateweather-timezone.h> -#include <libmateweather/location-entry.h> -#include <libmateweather/timezone-menu.h> -#include <libmateweather/mateweather-enum-types.h> - -%% -modulename mateweather -%% -import gtk.Entry as PyGtkEntry_Type -import gtk.ComboBox as PyGtkComboBox_Type -%% -ignore - mateweather_location_get_weather - mateweather_location_free_children - mateweather_location_free_timezones -%% -ignore-glob - *_get_type - *_ref - *_unref -%% -override mateweather_location_get_children -static PyObject * -_wrap_mateweather_location_get_children (PyGObject *self, PyObject *args) -{ - MateWeatherLocation *loc, **children; - int i; - PyObject *pychildren, *pychild; - - loc = pyg_boxed_get (self, MateWeatherLocation); - children = mateweather_location_get_children (loc); - for (i = 0; children[i]; i++) - ; - - pychildren = PyList_New (i); - for (i = 0; children[i]; i++) { - pychild = pyg_boxed_new (MATEWEATHER_TYPE_LOCATION, children[i], TRUE, TRUE); - PyList_SetItem (pychildren, i, pychild); - } - - mateweather_location_free_children (loc, children); - return pychildren; -} -%% -override mateweather_location_get_timezones -static PyObject * -_wrap_mateweather_location_get_timezones (PyGObject *self, PyObject *args) -{ - MateWeatherLocation *loc; - MateWeatherTimezone **zones; - int i; - PyObject *pyzones, *pyzone; - - loc = pyg_boxed_get (self, MateWeatherLocation); - zones = mateweather_location_get_timezones (loc); - for (i = 0; zones[i]; i++) - ; - - pyzones = PyList_New (i); - for (i = 0; zones[i]; i++) { - pyzone = pyg_boxed_new (MATEWEATHER_TYPE_TIMEZONE, zones[i], TRUE, TRUE); - PyList_SetItem (pyzones, i, pyzone); - } - - mateweather_location_free_timezones (loc, zones); - return pyzones; -} -%% -override mateweather_location_get_coords -static PyObject * -_wrap_mateweather_location_get_coords (PyGObject *self, PyObject *args) -{ - MateWeatherLocation *loc; - double latitude, longitude; - PyObject *ret; - - loc = pyg_boxed_get (self, MateWeatherLocation); - if (!mateweather_location_has_coords (loc)) { - Py_INCREF (Py_None); - return Py_None; - } - - mateweather_location_get_coords (loc, &latitude, &longitude); - ret = PyTuple_New (2); - PyTuple_SetItem (ret, 0, PyFloat_FromDouble (latitude)); - PyTuple_SetItem (ret, 1, PyFloat_FromDouble (longitude)); - return ret; -} -%% -new-constructor MATEWEATHER_TYPE_LOCATION_ENTRY -%% -new-constructor MATEWEATHER_TYPE_TIMEZONE_MENU -%% diff --git a/python/mateweathermodule.c b/python/mateweathermodule.c deleted file mode 100644 index 67ee89e..0000000 --- a/python/mateweathermodule.c +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * - * mateweathermodule.c: module wrapping mateweather. - * - * This library 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 library 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 library; if not, see - * <http://www.gnu.org/licenses/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* include this first, before NO_IMPORT_PYGOBJECT is defined */ -#include <pygobject.h> - -void pymateweather_register_classes (PyObject *d); -void pymateweather_add_constants(PyObject *module, const gchar *strip_prefix); -void _pymateweather_register_boxed_types(void); - -extern PyMethodDef pymateweather_functions[]; - -DL_EXPORT(void) -initmateweather(void) -{ - PyObject *m, *d; - - init_pygobject (); - - m = Py_InitModule ("mateweather", pymateweather_functions); - d = PyModule_GetDict (m); - pymateweather_register_classes (d); - pymateweather_add_constants(m, "MATEWEATHER_"); -} |