From d3b61d1e80a91482c2fc844810627064b1087280 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 12 Jul 2017 08:36:13 +0900 Subject: [PATCH] Imported Upstream version 2.28.1 Change-Id: Ib2dc5ea9bbd21a07cf091b6a5352485ef15f637a Signed-off-by: DongHun Kwak --- ChangeLog | 193 ++++++++++++++++++++++++++++++++++++++++++++++ Makefile.in | 1 - NEWS | 15 ++++ PKG-INFO | 4 +- codegen/Makefile.in | 1 - configure | 30 ++++--- configure.ac | 2 +- docs/Makefile.in | 1 - examples/Makefile.in | 1 - gi/Makefile.am | 4 +- gi/Makefile.in | 9 +-- gi/overrides/Gio.py | 21 ++++- gi/overrides/Gtk.py | 12 ++- gi/overrides/Makefile.in | 1 - gi/pygi-argument.c | 15 ++-- gi/repository/Makefile.in | 1 - gio/Makefile.am | 2 +- gio/Makefile.in | 5 +- glib/Makefile.am | 2 +- glib/Makefile.in | 6 +- gobject/Makefile.in | 1 - m4/python.m4 | 7 +- setup.py | 2 +- tests/Makefile.am | 2 +- tests/Makefile.in | 6 +- tests/test_gdbus.py | 13 ++++ tests/test_gi.py | 4 + tests/test_overrides.py | 34 ++++++-- 28 files changed, 320 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c95a17..7c994eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,196 @@ +commit 27dcb9b1963be0c0d18e19a0b108a4a64d5e048b +Author: John (J5) Palmieri +Date: Mon Mar 21 12:42:36 2011 -0400 + + prep for 2.28.1 release + + NEWS | 15 +++++++++++++++ + 1 files changed, 15 insertions(+), 0 deletions(-) + +commit 072d45cbfa7b360a0e616c4c56ba75d4dc08e7df +Author: John Stowers +Date: Sun Mar 6 23:41:30 2011 +1300 + + pygi-convert.sh remove gobject tests, GObject works now + + https://bugzilla.gnome.org/show_bug.cgi?id=644347 + + pygi-convert.sh | 28 ---------------------------- + 1 files changed, 0 insertions(+), 28 deletions(-) + +commit 205fee1622e461c0bcbe50e8befe30f01aac81eb +Author: John Stowers +Date: Sun Mar 6 23:41:01 2011 +1300 + + pygi-convert.sh add GObject.xxx and webkit + + https://bugzilla.gnome.org/show_bug.cgi?id=644347 + + pygi-convert.sh | 7 +++++++ + 1 files changed, 7 insertions(+), 0 deletions(-) + +commit f5ee2924af489c17b64e56be5d2bd1c39d1293d1 +Author: John (J5) Palmieri +Date: Wed Mar 16 17:34:18 2011 -0400 + + [gi] marshal raw closures + + * before we were able to marshal python callables into methods + that took + GClosures but we had no way to take a GClosure returned from one + method and pass it to another - this enables that usecase + + https://bugzilla.gnome.org/show_bug.cgi?id=644757 + + gi/pygi-argument.c | 15 ++++++++++----- + tests/test_gi.py | 4 ++++ + 2 files changed, 14 insertions(+), 5 deletions(-) + +commit ac11dc70b34fe077be18f7e605c9f3cce03ad3fa +Author: Martin Pitt +Date: Mon Mar 21 13:25:12 2011 +0100 + + Revert "Deduce PYTHON_LIBS in addition to PYTHON_INCLUDES" + + This reverts commit fc7d7f7f153d57ff3866b7bfd5e6479d702cc4d9. + + This introduces additional libpython dependencies, which breaks + distributions + which support multiple Python versions, and also causes the python + interpreter + to be in memory twice in some cases. + + https://bugzilla.gnome.org/show_bug.cgi?id=620215 + + gi/Makefile.am | 4 +--- + gio/Makefile.am | 2 +- + glib/Makefile.am | 2 +- + m4/python.m4 | 7 ++----- + tests/Makefile.am | 2 +- + 5 files changed, 6 insertions(+), 11 deletions(-) + +commit aed7582de1c0623042601c8038a7631fa41d087d +Author: Dieter Verfaillie +Date: Fri Mar 18 17:06:08 2011 +0100 + + setup.py: fix user_access_control option + + setup.py | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +commit 6f0d33101a2451854f216291813951349d5ac471 +Author: John (J5) Palmieri +Date: Wed Mar 16 15:20:43 2011 -0400 + + [gi-overrides] fix marshalling pygobjects in treemodels + + * PyGObjects wern't being marshalled correctly as python objects + when a + treemodel column was set to take pyobjects + * Fix this by explicetly marshalling all PyObjects as boxed gvalue + types + in the overrides + + gi/overrides/Gtk.py | 9 +++++---- + tests/test_overrides.py | 34 ++++++++++++++++++++++++++-------- + 2 files changed, 31 insertions(+), 12 deletions(-) + +commit adb6f0320bed9a00a96c99424d4982199dc85af2 +Author: Martin Pitt +Date: Wed Mar 16 10:22:35 2011 +0100 + + [gi] Respect the MessageType for Gtk.MessageDialog + + Don't just ignore the type argument, actually pass it on. Thanks + to Tualatrix + Chou for spotting this! + + gi/overrides/Gtk.py | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +commit 115c4750f071270b648218c9678931a65a4b3e3d +Author: Martin Pitt +Date: Tue Mar 15 10:22:39 2011 +0100 + + [gi] Do not require signature for D-BUS methods without arguments + + Calling methods on DBusProxy objects usually requires specifying + the signature + as first argument. However, if the D-BUS method does not take any + arguments, + specifying the empty '()' signature does not give any additional + information, + so allow the caller to just call the proxy method without any + arguments. + + Also ensure that passing a non-string signature raises a + comprehensible + exception, instead of crashing deep in the GVariant leaf constructor. + + https://bugzilla.gnome.org/show_bug.cgi?id=644260 + + gi/overrides/Gio.py | 16 +++++++++++++++- + tests/test_gdbus.py | 13 +++++++++++++ + 2 files changed, 28 insertions(+), 1 deletions(-) + +commit 0df9e153812e1e5077bb906449e211ecb0af8736 +Author: John (J5) Palmieri +Date: Fri Mar 11 14:09:02 2011 -0500 + + [gi-demos] add pickers demo + + demos/gtk-demo/demos/pickers.py | 74 + +++++++++++++++++++++++++++++++++++++++ + 1 files changed, 74 insertions(+), 0 deletions(-) + +commit 419bfdd44b566ffb88f71165c00728872987dc5e +Author: John (J5) Palmieri +Date: Thu Mar 10 18:12:50 2011 -0500 + + [gi-demos] add menu demo + + demos/gtk-demo/demos/menus.py | 122 + +++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 122 insertions(+), 0 deletions(-) + +commit 0877670e184a591866cbf3ab14284fcb217b540b +Author: John Stowers +Date: Sun Mar 6 23:05:33 2011 +1300 + + [gi-overrides] TreeViewColumn.set_cell_data_func func_data can be None + + https://bugzilla.gnome.org/show_bug.cgi?id=644343 + + gi/overrides/Gtk.py | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +commit 1f69c520d95fec30094fac47cb0efa31c79da81c +Author: John Stowers +Date: Sun Mar 6 17:48:04 2011 +1300 + + [gi-demos] dont try and run demos that represent directories + + demos/gtk-demo/gtk-demo.py | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +commit f06ad511725b28d821532acae45a25d0a186fc9f +Author: John (J5) Palmieri +Date: Wed Mar 9 13:02:50 2011 -0500 + + [gi-overrides] fix exception block so it works in Python 2.5 + + gi/overrides/Gio.py | 5 ++++- + 1 files changed, 4 insertions(+), 1 deletions(-) + +commit a784350b6e76c6c66fb2856dd597238f4ac992e9 +Author: John (J5) Palmieri +Date: Tue Mar 8 13:25:57 2011 -0500 + + post release version bump + + configure.ac | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + commit aa745352bb99862c360dc56e2fececc4b2968cbc Author: John (J5) Palmieri Date: Tue Mar 8 13:20:31 2011 -0500 diff --git a/Makefile.in b/Makefile.in index 1a8fbdd..e20eeca 100644 --- a/Makefile.in +++ b/Makefile.in @@ -238,7 +238,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ diff --git a/NEWS b/NEWS index 7a2d6e1..b38be2a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,18 @@ +2.28.1 21-Mar-2011 + - pygi-convert.sh remove gobject tests, GObject works now (John Stowers) + - pygi-convert.sh add GObject.xxx and webkit (John Stowers) + - [gi] marshal raw closures (John (J5) Palmieri) + - Revert "Deduce PYTHON_LIBS in addition to PYTHON_INCLUDES" (Martin Pit + - setup.py: fix user_access_control option (Dieter Verfaillie) + - [gi-overrides] fix marshalling pygobjects in treemodels (John (J5) Pal + - [gi] Respect the MessageType for Gtk.MessageDialog (Martin Pitt) + - [gi] Do not require signature for D-BUS methods without arguments (Mar + - [gi-demos] add pickers demo (John (J5) Palmieri) + - [gi-demos] add menu demo (John (J5) Palmieri) + - [gi-overrides] TreeViewColumn.set_cell_data_func func_data can be None + - [gi-demos] dont try and run demos that represent directories (John Sto + - [gi-overrides] fix exception block so it works in Python 2.5 (John (J5 + 2.28.0 08-Mar-2011 (stable) - [gi-demos] some python 3 compat fixes (John (J5) Palmieri) - [gi-demos] catch the correct error class (John (J5) Palmieri) diff --git a/PKG-INFO b/PKG-INFO index e9f17ea..7b2f543 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: PyGObject -Version: 2.28.0 +Version: 2.28.1 Summary: Python bindings for GObject Home-page: http://www.pygtk.org/ Author: James Henstridge @@ -8,7 +8,7 @@ Author-email: james@daa.com.au Maintainer: Johan Dahlin Maintainer-email: johan@gnome.org License: GNU LGPL -Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/pygobject-2.28.0.tar.gz +Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/pygobject-2.28.1.tar.gz Description: Python bindings for GLib, GObject and GIO Platform: POSIX, Windows Classifier: Development Status :: 5 - Production/Stable diff --git a/codegen/Makefile.in b/codegen/Makefile.in index 040c36e..12a8cf9 100644 --- a/codegen/Makefile.in +++ b/codegen/Makefile.in @@ -173,7 +173,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ diff --git a/configure b/configure index c213df1..3958f66 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for pygobject 2.28.0. +# Generated by GNU Autoconf 2.68 for pygobject 2.28.1. # # Report bugs to . # @@ -571,8 +571,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pygobject' PACKAGE_TARNAME='pygobject' -PACKAGE_VERSION='2.28.0' -PACKAGE_STRING='pygobject 2.28.0' +PACKAGE_VERSION='2.28.1' +PACKAGE_STRING='pygobject 2.28.1' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject' PACKAGE_URL='' @@ -657,7 +657,6 @@ ENABLE_DOCS_FALSE ENABLE_DOCS_TRUE XSLTPROC PLATFORM -PYTHON_LIBS PYTHON_INCLUDES pkgpyexecdir pyexecdir @@ -1381,7 +1380,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pygobject 2.28.0 to adapt to many kinds of systems. +\`configure' configures pygobject 2.28.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1451,7 +1450,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pygobject 2.28.0:";; + short | recursive ) echo "Configuration of pygobject 2.28.1:";; esac cat <<\_ACEOF @@ -1582,7 +1581,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pygobject configure 2.28.0 +pygobject configure 2.28.1 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1860,7 +1859,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pygobject $as_me 2.28.0, which was +It was created by pygobject $as_me 2.28.1, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2224,9 +2223,9 @@ $as_echo "#define PYGOBJECT_MINOR_VERSION 28" >>confdefs.h PYGOBJECT_MINOR_VERSION=28 -$as_echo "#define PYGOBJECT_MICRO_VERSION 0" >>confdefs.h +$as_echo "#define PYGOBJECT_MICRO_VERSION 1" >>confdefs.h -PYGOBJECT_MICRO_VERSION=0 +PYGOBJECT_MICRO_VERSION=1 ac_config_headers="$ac_config_headers config.h" @@ -2710,7 +2709,7 @@ fi # Define the identity of the package. PACKAGE='pygobject' - VERSION='2.28.0' + VERSION='2.28.1' cat >>confdefs.h <<_ACEOF @@ -12046,7 +12045,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -pygobject config.lt 2.28.0 +pygobject config.lt 2.28.1 configured by $0, generated by GNU Autoconf 2.68. Copyright (C) 2010 Free Software Foundation, Inc. @@ -14947,16 +14946,13 @@ py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"` PYTHON_CONFIG=`which $PYTHON`-config if test -x "$PYTHON_CONFIG"; then PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null` -PYTHON_LIBS=`$PYTHON_CONFIG --libs 2>/dev/null` else PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" -PYTHON_LIBS="-lpython${PYTHON_VERSION}" if test "$py_prefix" != "$py_exec_prefix"; then PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" fi fi - save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16785,7 +16781,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by pygobject $as_me 2.28.0, which was +This file was extended by pygobject $as_me 2.28.1, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16851,7 +16847,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -pygobject config.status 2.28.0 +pygobject config.status 2.28.1 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index eb54f65..f1cc041 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ m4_define(python3_min_ver, 3.1) dnl the pygobject version number m4_define(pygobject_major_version, 2) m4_define(pygobject_minor_version, 28) -m4_define(pygobject_micro_version, 0) +m4_define(pygobject_micro_version, 1) m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version) dnl versions of packages we require ... diff --git a/docs/Makefile.in b/docs/Makefile.in index 4b858ca..acb75a7 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -170,7 +170,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ diff --git a/examples/Makefile.in b/examples/Makefile.in index 1f8ed47..b0ab293 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -146,7 +146,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ diff --git a/gi/Makefile.am b/gi/Makefile.am index 28825ab..31f6c79 100644 --- a/gi/Makefile.am +++ b/gi/Makefile.am @@ -25,7 +25,6 @@ _gi_la_LDFLAGS = \ -export-symbols-regex "init_gi|PyInit__gi" _gi_la_LIBADD = \ $(GI_LIBS) \ - $(PYTHON_LIBS) \ $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la _gi_la_SOURCES = \ pygi-repository.c \ @@ -69,8 +68,7 @@ _gi_cairo_la_LDFLAGS = \ -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo" _gi_cairo_la_LIBADD = \ $(GI_LIBS) \ - $(PYCAIRO_LIBS) \ - $(PYTHON_LIBS) + $(PYCAIRO_LIBS) _gi_cairo_la_SOURCES = pygi-foreign-cairo.c diff --git a/gi/Makefile.in b/gi/Makefile.in index a5ccc12..3015b22 100644 --- a/gi/Makefile.in +++ b/gi/Makefile.in @@ -73,7 +73,7 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(pygidir)" "$(DESTDIR)$(pygidir)" LTLIBRARIES = $(pygi_LTLIBRARIES) am__DEPENDENCIES_1 = -_gi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +_gi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la am__gi_la_OBJECTS = _gi_la-pygi-repository.lo _gi_la-pygi-info.lo \ _gi_la-pygi-invoke.lo _gi_la-pygi-foreign.lo \ @@ -90,7 +90,7 @@ _gi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gi_la_CFLAGS) $(CFLAGS) \ $(_gi_la_LDFLAGS) $(LDFLAGS) -o $@ _gi_cairo_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) am__gi_cairo_la_OBJECTS = _gi_cairo_la-pygi-foreign-cairo.lo _gi_cairo_la_OBJECTS = $(am__gi_cairo_la_OBJECTS) _gi_cairo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -258,7 +258,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ @@ -351,7 +350,6 @@ _gi_la_LDFLAGS = \ _gi_la_LIBADD = \ $(GI_LIBS) \ - $(PYTHON_LIBS) \ $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la _gi_la_SOURCES = \ @@ -398,8 +396,7 @@ _gi_cairo_la_LDFLAGS = \ _gi_cairo_la_LIBADD = \ $(GI_LIBS) \ - $(PYCAIRO_LIBS) \ - $(PYTHON_LIBS) + $(PYCAIRO_LIBS) _gi_cairo_la_SOURCES = pygi-foreign-cairo.c pygi_LTLIBRARIES = _gi.la $(am__append_1) diff --git a/gi/overrides/Gio.py b/gi/overrides/Gio.py index 20343a2..20adf0c 100644 --- a/gi/overrides/Gio.py +++ b/gi/overrides/Gio.py @@ -23,6 +23,8 @@ from ..importer import modules from gi.repository import GLib +import sys + Gio = modules['Gio']._introspection_module __all__ = [] @@ -109,7 +111,8 @@ class _DBusProxyMethodCall: (result_callback, error_callback, real_user_data) = user_data try: ret = obj.call_finish(result) - except Exception as e: + except Exception: + etype, e = sys.exc_info()[:2] # return exception as value if error_callback: error_callback(obj, e, real_user_data) @@ -119,7 +122,17 @@ class _DBusProxyMethodCall: result_callback(obj, self._unpack_result(ret), real_user_data) - def __call__(self, signature, *args, **kwargs): + def __call__(self, *args, **kwargs): + # the first positional argument is the signature, unless we are calling + # a method without arguments; then signature is implied to be '()'. + if args: + signature = args[0] + args = args[1:] + if not isinstance(signature, str): + raise TypeError('first argument must be the method signature string: %r' % signature) + else: + signature = '()' + arg_variant = GLib.Variant(signature, tuple(args)) if 'result_handler' in kwargs: @@ -163,6 +176,10 @@ class DBusProxy(Gio.DBusProxy): proxy = Gio.DBusProxy.new_sync(...) result = proxy.MyMethod('(is)', 42, 'hello') + The exception are methods which take no arguments, like + proxy.MyMethod('()'). For these you can omit the signature and just write + proxy.MyMethod(). + Optional keyword arguments: - timeout: timeout for the call in milliseconds (default to D-Bus timeout) diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py index 55d139e..30e883c 100644 --- a/gi/overrides/Gtk.py +++ b/gi/overrides/Gtk.py @@ -410,6 +410,7 @@ class MessageDialog(Gtk.MessageDialog, Dialog): kwds['text'] = message_format Gtk.MessageDialog.__init__(self, _buttons_property=buttons, + message_type=type, **kwds) Dialog.__init__(self, parent=parent, flags=flags) @@ -731,9 +732,7 @@ class TreeModel(Gtk.TreeModel): # we may need to convert to a basic type type_ = self.get_column_type(column) - if type_ == GObject.TYPE_PYOBJECT: - pass # short-circut branching - elif type_ == GObject.TYPE_STRING: + if type_ == GObject.TYPE_STRING: if isinstance(value, str): value = str(value) elif sys.version_info < (3, 0): @@ -773,7 +772,10 @@ class TreeModel(Gtk.TreeModel): # so we don't have to do it here value_container = GObject.Value() value_container.init(type_) - if type_ == GObject.TYPE_CHAR: + if type_ == GObject.TYPE_PYOBJECT: + value_container.set_boxed(value) + value = value_container + elif type_ == GObject.TYPE_CHAR: value_container.set_char(value) value = value_container elif type_ == GObject.TYPE_UCHAR: @@ -1116,6 +1118,8 @@ class TreeViewColumn(Gtk.TreeViewColumn): if success: return (start_pos, width,) + def set_cell_data_func(self, cell_renderer, func, func_data=None): + super(TreeViewColumn, self).set_cell_data_func(cell_renderer, func, func_data) TreeViewColumn = override(TreeViewColumn) __all__.append('TreeViewColumn') diff --git a/gi/overrides/Makefile.in b/gi/overrides/Makefile.in index 7ba6f5e..96ce126 100644 --- a/gi/overrides/Makefile.in +++ b/gi/overrides/Makefile.in @@ -170,7 +170,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c index 1b31387..6519e5c 100644 --- a/gi/pygi-argument.c +++ b/gi/pygi-argument.c @@ -224,7 +224,8 @@ _pygi_g_type_interface_check_object (GIBaseInfo *info, /* Handle special cases. */ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info); if (g_type_is_a (type, G_TYPE_CLOSURE)) { - if (!PyCallable_Check (object)) { + if (!(PyCallable_Check (object) || + pyg_type_from_object_strict (object, FALSE) == G_TYPE_CLOSURE)) { PyErr_Format (PyExc_TypeError, "Must be callable, not %s", object->ob_type->tp_name); retval = 0; @@ -1072,10 +1073,14 @@ array_success: } else if (g_type_is_a (type, G_TYPE_CLOSURE)) { GClosure *closure; - closure = pyg_closure_new (object, NULL, NULL); - if (closure == NULL) { - PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GClosure failed"); - break; + if (pyg_type_from_object_strict (object, FALSE) == G_TYPE_CLOSURE) { + closure = (GClosure *)pyg_boxed_get (object, void); + } else { + closure = pyg_closure_new (object, NULL, NULL); + if (closure == NULL) { + PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GClosure failed"); + break; + } } arg.v_pointer = closure; diff --git a/gi/repository/Makefile.in b/gi/repository/Makefile.in index cb6de2a..7da2e99 100644 --- a/gi/repository/Makefile.in +++ b/gi/repository/Makefile.in @@ -170,7 +170,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ diff --git a/gio/Makefile.am b/gio/Makefile.am index b412043..6b3eb57 100644 --- a/gio/Makefile.am +++ b/gio/Makefile.am @@ -85,7 +85,7 @@ EXTRA_DIST += $(GIOUNIX_DEFS) unix.override unix.c: $(GIOUNIX_DEFS) unix.override unix_la_CFLAGS = $(GIOUNIX_CFLAGS) unix_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initunix -unix_la_LIBADD = $(GIOUNIX_LIBS) $(PYTHON_LIBS) +unix_la_LIBADD = $(GIOUNIX_LIBS) unix_la_SOURCES = unixmodule.c nodist_unix_la_SOURCES = unix.c if BUILD_GIOUNIX diff --git a/gio/Makefile.in b/gio/Makefile.in index 2e84fda..041c085 100644 --- a/gio/Makefile.in +++ b/gio/Makefile.in @@ -92,7 +92,7 @@ _gio_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gio_la_CFLAGS) \ $(CFLAGS) $(_gio_la_LDFLAGS) $(LDFLAGS) -o $@ @BUILD_GIO_TRUE@am__gio_la_rpath = -rpath $(pkgpyexecdir) -unix_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +unix_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_unix_la_OBJECTS = unix_la-unixmodule.lo nodist_unix_la_OBJECTS = unix_la-unix.lo unix_la_OBJECTS = $(am_unix_la_OBJECTS) $(nodist_unix_la_OBJECTS) @@ -224,7 +224,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ @@ -366,7 +365,7 @@ nodist__gio_la_SOURCES = gio.c GIOUNIX_DEFS = unix.defs unix-types.defs unix.override unix_la_CFLAGS = $(GIOUNIX_CFLAGS) unix_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initunix -unix_la_LIBADD = $(GIOUNIX_LIBS) $(PYTHON_LIBS) +unix_la_LIBADD = $(GIOUNIX_LIBS) unix_la_SOURCES = unixmodule.c nodist_unix_la_SOURCES = unix.c all: all-am diff --git a/glib/Makefile.am b/glib/Makefile.am index 32d0ec9..e210318 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -20,7 +20,7 @@ common_ldflags += -no-undefined endif libpyglib_2_0_@PYTHON_BASENAME@_la_CFLAGS = $(GLIB_CFLAGS) -libpyglib_2_0_@PYTHON_BASENAME@_la_LIBADD = $(GLIB_LIBS) $(FFI_LIBS) $(PYTHON_LIBS) +libpyglib_2_0_@PYTHON_BASENAME@_la_LIBADD = $(GLIB_LIBS) $(FFI_LIBS) libpyglib_2_0_@PYTHON_BASENAME@_la_SOURCES = \ pyglib.c \ pyglib.h \ diff --git a/glib/Makefile.in b/glib/Makefile.in index 2b72aaf..e23bffc 100644 --- a/glib/Makefile.in +++ b/glib/Makefile.in @@ -90,8 +90,7 @@ _glib_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_glib_la_CFLAGS) \ $(CFLAGS) $(_glib_la_LDFLAGS) $(LDFLAGS) -o $@ libpyglib_2_0_@PYTHON_BASENAME@_la_DEPENDENCIES = \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libpyglib_2_0_@PYTHON_BASENAME@_la_OBJECTS = \ libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.lo libpyglib_2_0_@PYTHON_BASENAME@_la_OBJECTS = \ @@ -226,7 +225,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ @@ -307,7 +305,7 @@ pyglib_PYTHON = \ pyglib_LTLIBRARIES = _glib.la common_ldflags = -module -avoid-version $(am__append_1) libpyglib_2_0_@PYTHON_BASENAME@_la_CFLAGS = $(GLIB_CFLAGS) -libpyglib_2_0_@PYTHON_BASENAME@_la_LIBADD = $(GLIB_LIBS) $(FFI_LIBS) $(PYTHON_LIBS) +libpyglib_2_0_@PYTHON_BASENAME@_la_LIBADD = $(GLIB_LIBS) $(FFI_LIBS) libpyglib_2_0_@PYTHON_BASENAME@_la_SOURCES = \ pyglib.c \ pyglib.h \ diff --git a/gobject/Makefile.in b/gobject/Makefile.in index 4f13264..be4bac8 100644 --- a/gobject/Makefile.in +++ b/gobject/Makefile.in @@ -223,7 +223,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ diff --git a/m4/python.m4 b/m4/python.m4 index 4f98ad7..523e45a 100644 --- a/m4/python.m4 +++ b/m4/python.m4 @@ -38,26 +38,23 @@ 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 and PYTHON_LIBS +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 and PYTHON_LIBS +dnl deduce PYTHON_INCLUDES py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"` PYTHON_CONFIG=`which $PYTHON`-config if test -x "$PYTHON_CONFIG"; then PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null` -PYTHON_LIBS=`$PYTHON_CONFIG --libs 2>/dev/null` else PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" -PYTHON_LIBS="-lpython${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) -AC_SUBST(PYTHON_LIBS) dnl check if the headers exist: save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" diff --git a/setup.py b/setup.py index 02cce00..74b9141 100755 --- a/setup.py +++ b/setup.py @@ -324,7 +324,7 @@ else: doclines = __doc__.split('\n') options = {'bdist_wininst': {'install_script': 'pygobject_postinstall.py', - 'user-access-control': 'auto'}} + 'user_access_control': 'auto'}} setup(name='pygobject', url='http://www.pygtk.org/', diff --git a/tests/Makefile.am b/tests/Makefile.am index e5c2a68..9cdb57f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -50,7 +50,7 @@ noinst_LTLIBRARIES += testhelper.la testhelper_la_CFLAGS = -I$(top_srcdir)/gobject -I$(top_srcdir)/glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS) testhelper_la_LDFLAGS = -module -avoid-version -testhelper_la_LIBADD = $(GLIB_LIBS) $(PYTHON_LIBS) +testhelper_la_LIBADD = $(GLIB_LIBS) testhelper_la_SOURCES = \ testhelpermodule.c \ test-floating.c \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 3084f8d..5c35ef3 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -72,8 +72,7 @@ libregress_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(CFLAGS) $(libregress_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_INTROSPECTION_TRUE@am_libregress_la_rpath = am__DEPENDENCIES_1 = -testhelper_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) +testhelper_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_testhelper_la_OBJECTS = testhelper_la-testhelpermodule.lo \ testhelper_la-test-floating.lo testhelper_la-test-thread.lo \ testhelper_la-test-unknown.lo @@ -203,7 +202,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ @@ -282,7 +280,7 @@ noinst_LTLIBRARIES = $(am__append_1) testhelper.la @ENABLE_INTROSPECTION_TRUE@libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) testhelper_la_CFLAGS = -I$(top_srcdir)/gobject -I$(top_srcdir)/glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS) testhelper_la_LDFLAGS = -module -avoid-version -testhelper_la_LIBADD = $(GLIB_LIBS) $(PYTHON_LIBS) +testhelper_la_LIBADD = $(GLIB_LIBS) testhelper_la_SOURCES = \ testhelpermodule.c \ test-floating.c \ diff --git a/tests/test_gdbus.py b/tests/test_gdbus.py index b40492c..a9442fe 100644 --- a/tests/test_gdbus.py +++ b/tests/test_gdbus.py @@ -142,6 +142,13 @@ class TestGDBusClient(unittest.TestCase): self.assertTrue('Timeout' in str(e), str(e)) + def test_python_calls_sync_noargs(self): + # methods without arguments don't need an explicit signature + result = self.dbus_proxy.ListNames() + self.assertTrue(isinstance(result, list)) + self.assertTrue(len(result) > 1) + self.assertTrue('org.freedesktop.DBus' in result) + def test_python_calls_sync_errors(self): # error case: invalid argument types try: @@ -152,6 +159,12 @@ class TestGDBusClient(unittest.TestCase): self.assertTrue('InvalidArgs' in str(e), str(e)) + try: + self.dbus_proxy.GetConnectionUnixProcessID(None, 'foo') + self.fail('call with None signature should raise an exception') + except TypeError as e: + self.assertTrue('signature' in str(e), str(e)) + def test_python_calls_async(self): def call_done(obj, result, user_data): user_data['result'] = result diff --git a/tests/test_gi.py b/tests/test_gi.py index 73eb6fc..4aa5532 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -945,6 +945,10 @@ class TestGClosure(unittest.TestCase): def test_gclosure_in(self): GIMarshallingTests.gclosure_in(lambda: 42) + # test passing a closure between two C calls + closure = GIMarshallingTests.gclosure_return() + GIMarshallingTests.gclosure_in(closure) + self.assertRaises(TypeError, GIMarshallingTests.gclosure_in, 42) self.assertRaises(TypeError, GIMarshallingTests.gclosure_in, None) diff --git a/tests/test_overrides.py b/tests/test_overrides.py index 9234d96..ea28d18 100644 --- a/tests/test_overrides.py +++ b/tests/test_overrides.py @@ -773,14 +773,21 @@ class TestGtk(unittest.TestCase): class TestPyObject(object): pass + class TestPyGObject(GObject.Object): + __gtype_name__ = 'TestPyGObject' + def __init__(self, i): + GObject.Object.__init__(self) + self.sentinal = i + 5 + test_pyobj = TestPyObject() test_pydict = {1:1, "2":2, "3":"3"} test_pylist = [1,"2", "3"] - list_store = Gtk.ListStore(int, str, 'GIOverrideTreeAPITest', object, object, object, bool, bool) + list_store = Gtk.ListStore(int, str, 'GIOverrideTreeAPITest', object, object, object, bool, bool, object) for i in range(93): label = 'this is row #%d' % i testobj = TestGtk.TestClass(self, i, label) + testpygobj = TestPyGObject(i) parent = list_store.append((i, label, testobj, @@ -788,7 +795,8 @@ class TestGtk(unittest.TestCase): test_pydict, test_pylist, i % 2, - bool(i % 2))) + bool(i % 2), + testpygobj)) i = 93 label = _unicode('this is row #93') @@ -801,6 +809,7 @@ class TestGtk(unittest.TestCase): list_store.set_value(treeiter, 5, test_pylist) list_store.set_value(treeiter, 6, 1) list_store.set_value(treeiter, 7, True) + list_store.set_value(treeiter, 8, TestPyGObject(i)) # test automatic unicode->str conversion i = 94 @@ -812,7 +821,8 @@ class TestGtk(unittest.TestCase): test_pydict, test_pylist, 0, - False)) + False, + TestPyGObject(i))) # add sorted items out of order to test insert* apis # also test sending in None to not set a column @@ -825,7 +835,8 @@ class TestGtk(unittest.TestCase): None, test_pylist, 1, - None)) + None, + TestPyGObject(i))) list_store.set_value(treeiter, 0, i) list_store.set_value(treeiter, 1, label) @@ -843,7 +854,8 @@ class TestGtk(unittest.TestCase): test_pydict, test_pylist, 1, - True)) + True, + TestPyGObject(i))) i = 96 label = 'this is row #96' @@ -854,7 +866,8 @@ class TestGtk(unittest.TestCase): test_pydict, test_pylist, 0, - False)) + False, + TestPyGObject(i))) i = 98 label = 'this is row #98' @@ -865,7 +878,8 @@ class TestGtk(unittest.TestCase): test_pydict, test_pylist, 0, - False)) + False, + TestPyGObject(i))) i = 95 @@ -877,7 +891,8 @@ class TestGtk(unittest.TestCase): test_pydict, test_pylist, 1, - True)) + True, + TestPyGObject(i))) self.assertEquals(len(list_store), 100) @@ -906,6 +921,9 @@ class TestGtk(unittest.TestCase): self.assertTrue(isinstance(bool_1, bool)) self.assertTrue(isinstance(bool_2, bool)) + pygobj = list_store.get_value(treeiter, 8) + self.assertEquals(pygobj.sentinal, i + 5) + treeiter = list_store.iter_next(treeiter) counter += 1 -- 2.7.4