diff options
author | James Henstridge <james@daa.com.au> | 2003-07-24 15:06:08 +0000 |
---|---|---|
committer | James Henstridge <jamesh@src.gnome.org> | 2003-07-24 15:06:08 +0000 |
commit | 509bdda1a0db371fccb1d3b8e11a90c8040aaaf9 (patch) | |
tree | 8c0801159e4bf2d57ac9f6d7338e524609245052 | |
parent | 51c69a99945ad3d8f76414e59d6992fe1cae6fcb (diff) | |
download | pygtk-509bdda1a0db371fccb1d3b8e11a90c8040aaaf9.tar.gz |
same here.
2003-07-24 James Henstridge <james@daa.com.au>
* gtk/pygtk.h (init_pygtk): same here.
* pygobject.h (init_pygobject): convert fatal errors to normal
exceptions.
* gtk/gtkglmodule.c (initgl): same here.
* gtk/libglademodule.c (initglade): same here.
* gtk/gtkmodule.c (init_gtk): same here.
* atkmodule.c (initatk): same here.
* pangomodule.c (initpango): same here.
* gobjectmodule.c (initgobject): don't cause fatal errors if an
exception on init.
* codegen/codegen.py (write_source): print an error message if it
isn't possible to import a particular name from the module.
* autogen.sh (DIE): require Automake 1.7.
* configure.in (AC_ARG_ENABLE): enable thread support by default.
-rw-r--r-- | ChangeLog | 27 | ||||
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | atkmodule.c | 4 | ||||
-rwxr-xr-x | autogen.sh | 5 | ||||
-rw-r--r-- | codegen/codegen.py | 9 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | gobject/gobjectmodule.c | 5 | ||||
-rw-r--r-- | gobject/pygobject.h | 6 | ||||
-rw-r--r-- | gobjectmodule.c | 5 | ||||
-rw-r--r-- | gtk/Makefile.am | 18 | ||||
-rw-r--r-- | gtk/gtkglmodule.c | 3 | ||||
-rw-r--r-- | gtk/gtkmodule.c | 3 | ||||
-rw-r--r-- | gtk/libglademodule.c | 3 | ||||
-rw-r--r-- | gtk/pygtk.h | 10 | ||||
-rw-r--r-- | pangomodule.c | 2 | ||||
-rw-r--r-- | pygobject.h | 6 |
16 files changed, 60 insertions, 56 deletions
@@ -1,3 +1,30 @@ +2003-07-24 James Henstridge <james@daa.com.au> + + * gtk/pygtk.h (init_pygtk): same here. + + * pygobject.h (init_pygobject): convert fatal errors to normal + exceptions. + + * gtk/gtkglmodule.c (initgl): same here. + + * gtk/libglademodule.c (initglade): same here. + + * gtk/gtkmodule.c (init_gtk): same here. + + * atkmodule.c (initatk): same here. + + * pangomodule.c (initpango): same here. + + * gobjectmodule.c (initgobject): don't cause fatal errors if an + exception on init. + + * codegen/codegen.py (write_source): print an error message if it + isn't possible to import a particular name from the module. + + * autogen.sh (DIE): require Automake 1.7. + + * configure.in (AC_ARG_ENABLE): enable thread support by default. + 2003-07-23 James Henstridge <james@daa.com.au> * gtk/gtk.override (_wrap_gtk_dialog_add_buttons): add diff --git a/Makefile.am b/Makefile.am index 481598fc..ee7769d6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ -# require automake-1.6 -AUTOMAKE_OPTIONS = 1.6 +# require automake-1.7 +AUTOMAKE_OPTIONS = 1.7 SUBDIRS = codegen gtk docs @@ -41,11 +41,7 @@ pkgpyexec_LTLIBRARIES = \ pango.la \ atk.la -if PLATFORM_WIN32 common_ldflags = -module -avoid-version -no-undefined -else -common_ldflags = -module -avoid-version -endif # gobject module gobject_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initgobject diff --git a/atkmodule.c b/atkmodule.c index 47ad7c5b..ca1dbfdc 100644 --- a/atkmodule.c +++ b/atkmodule.c @@ -44,8 +44,4 @@ initatk(void) pyatk_register_classes (d); pyatk_add_constants(m, "ATK_"); - - if (PyErr_Occurred ()) { - Py_FatalError ("can't initialise module atk"); - } } @@ -35,13 +35,10 @@ if test -z "$AUTOMAKE"; then if automake-1.7 --version < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 - elif automake-1.6 --version < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake-1.6 - ACLOCAL=aclocal-1.6 else echo echo "You must have automake installed to compile $PROJECT." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.7.2.tar.gz" + echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.7.6.tar.gz" echo "(or a newer version if it is available)" DIE=1 fi diff --git a/codegen/codegen.py b/codegen/codegen.py index 94148537..c510c30f 100644 --- a/codegen/codegen.py +++ b/codegen/codegen.py @@ -671,8 +671,15 @@ def write_source(parser, overrides, prefix, fp=FileOutput(sys.stdout)): fp.write(' PyObject *moddict = PyModule_GetDict(module);\n\n') for pyname, cname in bymod[module]: fp.write(' _%s = (PyTypeObject *)PyDict_GetItemString(moddict, "%s");\n' % (cname, pyname)) + fp.write(' if (_%s == NULL) {\n' % cname) + fp.write(' PyErr_SetString(PyExc_ImportError,\n') + fp.write(' "cannot import name %s from %s");\n' + % (pyname, module)) + fp.write(' return;\n') + fp.write(' }\n') fp.write(' } else {\n') - fp.write(' Py_FatalError("could not import %s");\n' %module) + fp.write(' PyErr_SetString(PyExc_ImportError,\n') + fp.write(' "could not import %s");\n' % module) fp.write(' return;\n') fp.write(' }\n') fp.write('\n') diff --git a/configure.in b/configure.in index 6752193c..7da1ef45 100644 --- a/configure.in +++ b/configure.in @@ -67,7 +67,7 @@ AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) AC_ARG_ENABLE(thread, AC_HELP_STRING([--disable-thread], [Disable pygtk threading support]),, - enable_thread=no) + enable_thread=yes) AM_CHECK_PYMOD(thread,,,enable_thread=no) diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index e5165bd2..74216295 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -2075,9 +2075,4 @@ initgobject(void) PyModule_AddObject(m, "TYPE_PARAM", pyg_type_wrapper_new(G_TYPE_PARAM)); PyModule_AddObject(m, "TYPE_OBJECT", pyg_type_wrapper_new(G_TYPE_OBJECT)); PyModule_AddObject(m, "TYPE_PYOBJECT", pyg_type_wrapper_new(PY_TYPE_OBJECT)); - - if (PyErr_Occurred()) { - PyErr_Print(); - Py_FatalError("can't initialise module gobject"); - } } diff --git a/gobject/pygobject.h b/gobject/pygobject.h index 2c769d67..62c4cd2f 100644 --- a/gobject/pygobject.h +++ b/gobject/pygobject.h @@ -151,11 +151,13 @@ struct _PyGObject_Functions *_PyGObject_API; if (PyCObject_Check(cobject)) \ _PyGObject_API = (struct _PyGObject_Functions *)PyCObject_AsVoidPtr(cobject); \ else { \ - Py_FatalError("could not find _PyGObject_API object"); \ + PyErr_SetString(PyExc_RuntimeError, \ + "could not find _PyGObject_API object"); \ return; \ } \ } else { \ - Py_FatalError("could not import gobject"); \ + PyErr_SetString(PyExc_ImportError, \ + "could not import gobject"); \ return; \ } \ } diff --git a/gobjectmodule.c b/gobjectmodule.c index e5165bd2..74216295 100644 --- a/gobjectmodule.c +++ b/gobjectmodule.c @@ -2075,9 +2075,4 @@ initgobject(void) PyModule_AddObject(m, "TYPE_PARAM", pyg_type_wrapper_new(G_TYPE_PARAM)); PyModule_AddObject(m, "TYPE_OBJECT", pyg_type_wrapper_new(G_TYPE_OBJECT)); PyModule_AddObject(m, "TYPE_PYOBJECT", pyg_type_wrapper_new(PY_TYPE_OBJECT)); - - if (PyErr_Occurred()) { - PyErr_Print(); - Py_FatalError("can't initialise module gobject"); - } } diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 200d8e44..93522b6e 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -20,12 +20,7 @@ INCLUDES = -I$(top_srcdir) $(PYTHON_INCLUDES) COMMONDEFS = $(srcdir)/gtk-types.defs $(srcdir)/gdk-types.defs \ $(top_srcdir)/atk-types.defs $(top_srcdir)/pango-types.defs -if PLATFORM_WIN32 common_ldflags = -module -avoid-version -no-undefined -pygtk_win32_sources = gtk-fake-win32.c -else -common_ldflags = -module -avoid-version -endif # gtk module pygtkexec_LTLIBRARIES = _gtk.la @@ -41,10 +36,13 @@ _gtk_la_SOURCES = \ pygtktreemodel.h \ pygtktreemodel.c \ pygtkcellrenderer.h \ - pygtkcellrenderer.c \ - $(pygtk_win32_sources) + pygtkcellrenderer.c nodist__gtk_la_SOURCES = gtk.c gdk.c +if PLATFORM_WIN32 +_gtk_la_SOURCES += gtk-fake-win32.c +endif + # prevent the .defs.c rule from trying to generate gtk-types.c because # there is gtk-types.defs. This is basically a hack and I really wish I # could use pattern rules. Perhaps we should rename gtk-types.c. @@ -78,9 +76,8 @@ EXTRA_DIST += $(gtk_overrides) # libglade module if BUILD_LIBGLADE -glade_la = glade.la +pygtkexec_LTLIBRARIES += glade.la endif -pygtkexec_LTLIBRARIES += $(glade_la) glade_la_CFLAGS = $(LIBGLADE_CFLAGS) glade_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initglade glade_la_LIBADD = $(LIBGLADE_LIBS) @@ -93,9 +90,8 @@ EXTRA_DIST += libglade.override # gtkgl module if BUILD_GTKGL -gl_la = gl.la +pygtkexec_LTLIBRARIES += gl.la endif -pygtkexec_LTLIBRARIES += $(gl_la) gl_la_CFLAGS = $(GTKGL_CFLAGS) gl_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initgl gl_la_LIBADD = $(GTKGL_LIBS) diff --git a/gtk/gtkglmodule.c b/gtk/gtkglmodule.c index c6235fd5..8a8d2293 100644 --- a/gtk/gtkglmodule.c +++ b/gtk/gtkglmodule.c @@ -89,7 +89,4 @@ initgl(void) PyDict_SetItemString(d, "ACCUM_ALPHA_SIZE", c=PyInt_FromLong(GDK_GL_ACCUM_ALPHA_SIZE)); Py_DECREF(c); - - if (PyErr_Occurred()) - Py_FatalError("could not initialise module gtk.gl"); } diff --git a/gtk/gtkmodule.c b/gtk/gtkmodule.c index 03e4ae79..b40b4774 100644 --- a/gtk/gtkmodule.c +++ b/gtk/gtkmodule.c @@ -190,8 +190,5 @@ init_gtk(void) pygdk_register_classes(d); pygdk_add_constants(m, "GDK_"); - if (PyErr_Occurred()) - Py_FatalError("can't initialise module _gtk"); - gtk_timeout_add(100, python_do_pending_calls, NULL); } diff --git a/gtk/libglademodule.c b/gtk/libglademodule.c index 6bba642b..9df9a53a 100644 --- a/gtk/libglademodule.c +++ b/gtk/libglademodule.c @@ -45,7 +45,4 @@ initglade(void) glade_init(); pylibglade_register_classes(d); - - if (PyErr_Occurred()) - Py_FatalError("could not initialise module gtk.libglade"); } diff --git a/gtk/pygtk.h b/gtk/pygtk.h index e34dc174..f4df2e5f 100644 --- a/gtk/pygtk.h +++ b/gtk/pygtk.h @@ -59,12 +59,14 @@ struct _PyGtk_FunctionStruct *_PyGtk_API; _PyGtk_API = (struct _PyGtk_FunctionStruct*) \ PyCObject_AsVoidPtr(cobject); \ else { \ - Py_FatalError("could not find _PyGtk_API object"); \ + PyErr_SetString(PyExc_RuntimeError, \ + "could not find _PyGtk_API object"); \ return; \ - } \ + } \ } else { \ - Py_FatalError("could not import _gtk"); \ - return; \ + PyErr_SetString(PyExc_ImportError, \ + "could not import gtk._gtk"); \ + return; \ } \ } diff --git a/pangomodule.c b/pangomodule.c index d30fb7b7..b1652217 100644 --- a/pangomodule.c +++ b/pangomodule.c @@ -67,6 +67,4 @@ initpango(void) /* add anything else to the module dictionary (such as constants) */ - if (PyErr_Occurred()) - Py_FatalError("could not initialise module pango"); } diff --git a/pygobject.h b/pygobject.h index 2c769d67..62c4cd2f 100644 --- a/pygobject.h +++ b/pygobject.h @@ -151,11 +151,13 @@ struct _PyGObject_Functions *_PyGObject_API; if (PyCObject_Check(cobject)) \ _PyGObject_API = (struct _PyGObject_Functions *)PyCObject_AsVoidPtr(cobject); \ else { \ - Py_FatalError("could not find _PyGObject_API object"); \ + PyErr_SetString(PyExc_RuntimeError, \ + "could not find _PyGObject_API object"); \ return; \ } \ } else { \ - Py_FatalError("could not import gobject"); \ + PyErr_SetString(PyExc_ImportError, \ + "could not import gobject"); \ return; \ } \ } |