From fca788c706317aa371e81c1c070c888ad245b31f Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Sun, 27 Jul 2008 10:30:30 +0000 Subject: Remove tabs. Use sys.exc_info()[1] to fetch the exception value 2008-07-27 Johan Dahlin * glib/option.py: Remove tabs. Use sys.exc_info()[1] to fetch the exception value * gobject/__init__.py: * gobject/propertyhelper.py: Import gobject._gobject instead of just gobject. * gobject/Makefile.am: * gobject/constants.py.in: * gobject/generate-constants.c (main): Don't add long suffix if python >= 3.0 svn path=/trunk/; revision=887 --- gobject/Makefile.am | 3 ++- gobject/__init__.py | 4 ++-- gobject/constants.py.in | 47 +++++++++++++++++++++++--------------------- gobject/generate-constants.c | 13 +++++++++--- gobject/propertyhelper.py | 6 +++++- 5 files changed, 44 insertions(+), 29 deletions(-) (limited to 'gobject') diff --git a/gobject/Makefile.am b/gobject/Makefile.am index 41dcf6d..e59daa4 100644 --- a/gobject/Makefile.am +++ b/gobject/Makefile.am @@ -26,7 +26,8 @@ constants.py: generate-constants$(EXEEXT) constants.py.in $(top_builddir)/gobject/generate-constants$(EXEEXT) >> constants.py chmod 444 constants.py -generate_constants_CFLAGS = $(GLIB_CFLAGS) +generate_constants_CFLAGS = $(GLIB_CFLAGS) $(PYTHON_INCLUDES) + noinst_PROGRAMS = generate-constants CLEANFILES = constants.py EXTRA_DIST = constants.py.in diff --git a/gobject/__init__.py b/gobject/__init__.py index cf8be3f..ae2c5be 100644 --- a/gobject/__init__.py +++ b/gobject/__init__.py @@ -52,10 +52,10 @@ from glib import SPAWN_LEAVE_DESCRIPTORS_OPEN, SPAWN_DO_NOT_REAP_CHILD, \ OPTION_ERROR_FAILED, OPTION_REMAINING, OPTION_ERROR from gobject.constants import * -from _gobject import * +from gobject._gobject import * _PyGObject_API = _gobject._PyGObject_API -from propertyhelper import property +from gobject.propertyhelper import property sys.modules['gobject.option'] = option diff --git a/gobject/constants.py.in b/gobject/constants.py.in index 6cb2d4f..80bf920 100644 --- a/gobject/constants.py.in +++ b/gobject/constants.py.in @@ -19,29 +19,32 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA -from _gobject import type_from_name +import sys + +import gobject._gobject +_gobject = sys.modules['gobject._gobject'] # TYPE_INVALID defined in gobjectmodule.c -TYPE_NONE = type_from_name('void') -TYPE_INTERFACE = type_from_name('GInterface') -TYPE_CHAR = type_from_name('gchar') -TYPE_UCHAR = type_from_name('guchar') -TYPE_BOOLEAN = type_from_name('gboolean') -TYPE_INT = type_from_name('gint') -TYPE_UINT = type_from_name('guint') -TYPE_LONG = type_from_name('glong') -TYPE_ULONG = type_from_name('gulong') -TYPE_INT64 = type_from_name('gint64') -TYPE_UINT64 = type_from_name('guint64') -TYPE_ENUM = type_from_name('GEnum') -TYPE_FLAGS = type_from_name('GFlags') -TYPE_FLOAT = type_from_name('gfloat') -TYPE_DOUBLE = type_from_name('gdouble') -TYPE_STRING = type_from_name('gchararray') -TYPE_POINTER = type_from_name('gpointer') -TYPE_BOXED = type_from_name('GBoxed') -TYPE_PARAM = type_from_name('GParam') -TYPE_OBJECT = type_from_name('GObject') -TYPE_PYOBJECT = type_from_name('PyObject') +TYPE_NONE = _gobject.type_from_name('void') +TYPE_INTERFACE = _gobject.type_from_name('GInterface') +TYPE_CHAR = _gobject.type_from_name('gchar') +TYPE_UCHAR = _gobject.type_from_name('guchar') +TYPE_BOOLEAN = _gobject.type_from_name('gboolean') +TYPE_INT = _gobject.type_from_name('gint') +TYPE_UINT = _gobject.type_from_name('guint') +TYPE_LONG = _gobject.type_from_name('glong') +TYPE_ULONG = _gobject.type_from_name('gulong') +TYPE_INT64 = _gobject.type_from_name('gint64') +TYPE_UINT64 = _gobject.type_from_name('guint64') +TYPE_ENUM = _gobject.type_from_name('GEnum') +TYPE_FLAGS = _gobject.type_from_name('GFlags') +TYPE_FLOAT = _gobject.type_from_name('gfloat') +TYPE_DOUBLE = _gobject.type_from_name('gdouble') +TYPE_STRING = _gobject.type_from_name('gchararray') +TYPE_POINTER = _gobject.type_from_name('gpointer') +TYPE_BOXED = _gobject.type_from_name('GBoxed') +TYPE_PARAM = _gobject.type_from_name('GParam') +TYPE_OBJECT = _gobject.type_from_name('GObject') +TYPE_PYOBJECT = _gobject.type_from_name('PyObject') TYPE_UNICHAR = TYPE_UINT diff --git a/gobject/generate-constants.c b/gobject/generate-constants.c index 2a6e4d2..f872a36 100644 --- a/gobject/generate-constants.c +++ b/gobject/generate-constants.c @@ -1,5 +1,12 @@ #include #include +#include + +#if PY_VERSION_HEX < 0x03000000 +# define LONGSUFFIX "L" +#else +# define LONGSUFFIX "" +#endif int main(void) { @@ -15,8 +22,8 @@ int main(void) printf("G_MININT = %d\n", G_MININT); printf("G_MAXINT = %d\n", G_MAXINT); printf("G_MAXUINT = %u\n", G_MAXUINT); - printf("G_MINLONG = %ldL\n", G_MINLONG); - printf("G_MAXLONG = %ldL\n", G_MAXLONG); - printf("G_MAXULONG = %luL\n", G_MAXULONG); + printf("G_MINLONG = %ld%s\n", G_MINLONG, LONGSUFFIX); + printf("G_MAXLONG = %ld%s\n", G_MAXLONG, LONGSUFFIX); + printf("G_MAXULONG = %lu%s\n", G_MAXULONG, LONGSUFFIX); return 0; } diff --git a/gobject/propertyhelper.py b/gobject/propertyhelper.py index 287516b..faf1562 100644 --- a/gobject/propertyhelper.py +++ b/gobject/propertyhelper.py @@ -19,7 +19,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA -import _gobject +import sys + +import gobject._gobject +_gobject = sys.modules['gobject._gobject'] + from gobject.constants import \ TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR, \ TYPE_BOOLEAN, TYPE_INT, TYPE_UINT, TYPE_LONG, \ -- cgit