diff options
author | Johan Dahlin <johan@src.gnome.org> | 2006-04-11 15:14:36 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2006-04-11 15:14:36 +0000 |
commit | c10ecb8121f62361f744fd3d6034c9339890f6f8 (patch) | |
tree | 77cae05805368e46a7a4b34dff8df104c4d630cb | |
parent | dd6f0893eaea89726576fc960257334d00d4544e (diff) | |
download | pygobject-c10ecb8121f62361f744fd3d6034c9339890f6f8.tar.gz pygobject-c10ecb8121f62361f744fd3d6034c9339890f6f8.tar.xz pygobject-c10ecb8121f62361f744fd3d6034c9339890f6f8.zip |
Turn gobject into a package; move _gobject to gobject._gobject and
add gobject/__init__.py. Update macros and testsuite.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | gobject/.cvsignore | 1 | ||||
-rw-r--r-- | gobject/Makefile.am | 16 | ||||
-rw-r--r-- | gobject/__init__.py | 30 | ||||
-rw-r--r-- | gobject/gobjectmodule.c | 4 | ||||
-rw-r--r-- | gobject/pygobject.h | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 8 | ||||
-rw-r--r-- | tests/common.py | 19 |
8 files changed, 70 insertions, 25 deletions
@@ -1,5 +1,18 @@ 2006-04-11 Johan Dahlin <jdahlin@async.com.br> + * gobject/.cvsignore: + * gobject/Makefile.am: + * gobject/__init__.py: + * gobject/gobjectmodule.c: (init_gobject): + * gobject/pygobject.h: + * tests/Makefile.am: + * tests/common.py: + + Turn gobject into a package; move _gobject to gobject._gobject and + add gobject/__init__.py. Update macros and testsuite. + +2006-04-11 Johan Dahlin <jdahlin@async.com.br> + * configure.ac: Post release version bump === PyGObject 2.10.1 === diff --git a/gobject/.cvsignore b/gobject/.cvsignore index 6e5ca7e..eaa2776 100644 --- a/gobject/.cvsignore +++ b/gobject/.cvsignore @@ -4,3 +4,4 @@ Makefile.in .libs *.lo *.la +*.pyc diff --git a/gobject/Makefile.am b/gobject/Makefile.am index 2416fd5..d8e17c3 100644 --- a/gobject/Makefile.am +++ b/gobject/Makefile.am @@ -6,17 +6,21 @@ pkgincludedir = $(includedir)/pygtk-$(PLATFORM_VERSION) pkginclude_HEADERS = pygobject.h pkgpyexecdir = $(pyexecdir)/gtk-2.0 -pkgpyexec_LTLIBRARIES = gobject.la +pkgpyexec_LTLIBRARIES = _gobject.la common_ldflags = -module -avoid-version if PLATFORM_WIN32 common_ldflags += -no-undefined endif -gobject_la_CFLAGS = $(GLIB_CFLAGS) -gobject_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initgobject -gobject_la_LIBADD = $(GLIB_LIBS) -gobject_la_SOURCES = \ +# gobject python scripts +pygobjectdir = $(pkgpythondir)/gtk +pygobject_PYTHON = __init__.py + +_gobject_la_CFLAGS = $(GLIB_CFLAGS) +_gobject_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gobject +_gobject_la_LIBADD = $(GLIB_LIBS) +_gobject_la_SOURCES = \ gobjectmodule.c \ pygboxed.c \ pygenum.c \ @@ -33,5 +37,5 @@ gobject_la_SOURCES = \ pygtype.c if PLATFORM_WIN32 -gobject_la_CFLAGS += -DPLATFORM_WIN32 +_gobject_la_CFLAGS += -DPLATFORM_WIN32 endif diff --git a/gobject/__init__.py b/gobject/__init__.py new file mode 100644 index 0000000..c31c777 --- /dev/null +++ b/gobject/__init__.py @@ -0,0 +1,30 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# pygobject - Python bindings for the GObject library +# Copyright (C) 2006 Johan Dahlin +# +# gobject/__init__.py: initialisation file for gobject module +# +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA + +# this can go when things are a little further along +try: + import ltihooks + ltihooks # pyflakes + del ltihooks +except ImportError: + pass + +from _gobject import * diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 30d0e5c..9f4faaf 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -2966,7 +2966,7 @@ struct _PyGObject_Functions pygobject_api_functions = { Py_DECREF(o); DL_EXPORT(void) -initgobject(void) +init_gobject(void) { PyObject *m, *d, *o, *tuple; PyObject *descr; @@ -2974,7 +2974,7 @@ initgobject(void) PyGParamSpec_Type.ob_type = &PyType_Type; - m = Py_InitModule("gobject", pygobject_functions); + m = Py_InitModule("gobject._gobject", pygobject_functions); d = PyModule_GetDict(m); g_type_init(); diff --git a/gobject/pygobject.h b/gobject/pygobject.h index 55c72b1..2115b34 100644 --- a/gobject/pygobject.h +++ b/gobject/pygobject.h @@ -263,7 +263,7 @@ struct _PyGObject_Functions *_PyGObject_API; } G_STMT_END #define init_pygobject() G_STMT_START { \ - PyObject *gobject = PyImport_ImportModule("gobject"); \ + PyObject *gobject = PyImport_ImportModule("gobject._gobject"); \ if (gobject != NULL) { \ PyObject *mdict = PyModule_GetDict(gobject); \ PyObject *cobject = PyDict_GetItemString(mdict, "_PyGObject_API"); \ @@ -276,7 +276,7 @@ struct _PyGObject_Functions *_PyGObject_API; } \ } else { \ PyErr_SetString(PyExc_ImportError, \ - "could not import gobject"); \ + "could not import gobject._gobjet"); \ return; \ } \ } G_STMT_END diff --git a/tests/Makefile.am b/tests/Makefile.am index 39ba16d..8ccb3c3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -37,6 +37,12 @@ tests = \ testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES) $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS) -check-local: +check-local: $(top_srcdir)/gobject/__init__.py + @if test "$(top_builddir)" != "$(top_srcdir)"; then \ + cp $(top_srcdir)/gobject/__init__.py $(top_builddir)/gobject/__init__.py; \ + fi @$(PYTHON) $(srcdir)/runtests.py $(top_builddir) $(top_srcdir) + @if test "$(top_builddir)" != "$(top_srcdir)"; then \ + rm -f $(top_builddir)/gobject/__init__.py*; \ + fi @rm -fr *.pyc diff --git a/tests/common.py b/tests/common.py index 3cd6386..ef040af 100644 --- a/tests/common.py +++ b/tests/common.py @@ -7,16 +7,15 @@ def importModules(buildDir, srcDir): # ltihooks sys.path.insert(0, srcDir) + sys.path.insert(0, buildDir) + sys.path.insert(0, os.path.join(buildDir, 'gobject')) import ltihooks - sys.path.remove(srcDir) - # gobject - sys.path.insert(0, os.path.join(buildDir, 'gobject')) # testhelper sys.path.insert(0, os.path.join(buildDir, 'tests')) sys.argv.append('--g-fatal-warnings') - gobject = importModule('gobject', buildDir, 'gobject/gobject.la') + gobject = importModule('gobject', buildDir, 'gobject') testhelper = importModule('testhelper', '.') ltihooks.uninstall() @@ -31,20 +30,13 @@ def importModule(module, directory, name=None): global isDistCheck origName = module - if '.' in module: - fromlist = '.'.join(module.split('.')[:-1]) - else: - fromlist = None - if not name: name = module + '.la' try: - obj = __import__(module, {}, {}, fromlist) + obj = __import__(module, {}, {}, '') except ImportError, e: - print 'WARNING: %s could not be imported' % origName - print e - return + raise SystemExit('%s could not be imported' % origName) if hasattr(obj, '__file__'): location = obj.__file__ @@ -58,5 +50,4 @@ def importModule(module, directory, name=None): if current != expected: raise AssertionError('module %s imported from wrong location. Expected %s, got %s' % ( module, expected, current)) - return obj |