diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:50:22 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:50:26 +0900 |
commit | b7c39029f61737ea3d15939422b43a3d8e747ea1 (patch) | |
tree | 2887f114803e374ea82393d73cb14dd4d721a429 | |
parent | 321841ba84f12124d94039cd8bbf60b3d342f6e3 (diff) | |
download | pygobject2-b7c39029f61737ea3d15939422b43a3d8e747ea1.tar.gz pygobject2-b7c39029f61737ea3d15939422b43a3d8e747ea1.tar.bz2 pygobject2-b7c39029f61737ea3d15939422b43a3d8e747ea1.zip |
Imported Upstream version 3.9.90
Change-Id: I7384b17a6248a1c1c81dc7db322b4f0ce1676c30
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
-rw-r--r-- | ChangeLog | 90 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | NEWS | 11 | ||||
-rw-r--r-- | PKG-INFO | 4 | ||||
-rw-r--r-- | aclocal.m4 | 6 | ||||
-rwxr-xr-x | config.guess | 8 | ||||
-rwxr-xr-x | config.sub | 13 | ||||
-rwxr-xr-x | configure | 24 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rwxr-xr-x | depcomp | 3 | ||||
-rw-r--r-- | examples/Makefile.in | 2 | ||||
-rw-r--r-- | gi/Makefile.in | 2 | ||||
-rw-r--r-- | gi/_glib/Makefile.in | 2 | ||||
-rw-r--r-- | gi/_glib/pygspawn.c | 9 | ||||
-rw-r--r-- | gi/_gobject/Makefile.in | 2 | ||||
-rw-r--r-- | gi/_gobject/signalhelper.py | 19 | ||||
-rw-r--r-- | gi/overrides/Makefile.in | 2 | ||||
-rw-r--r-- | gi/repository/Makefile.in | 2 | ||||
-rw-r--r-- | pygtkcompat/Makefile.in | 2 | ||||
-rw-r--r-- | tests/Makefile.in | 2 | ||||
-rw-r--r-- | tests/test_signal.py | 87 | ||||
-rw-r--r-- | tests/test_subprocess.py | 1 |
22 files changed, 207 insertions, 88 deletions
@@ -1,3 +1,93 @@ +commit 6fbe2580deda215896e9583b418b8bc1aceb2f96 +Author: Martin Pitt <martinpitt@gnome.org> +Date: Mon Aug 19 17:10:52 2013 +0200 + + release 3.9.90 + + NEWS | 9 +++++++++ + 1 file changed, 9 insertions(+) + +commit a8d5da559ef088b05062681206758d2718946269 +Author: Martin Pitt <martinpitt@gnome.org> +Date: Mon Aug 19 11:38:31 2013 +0200 + + NEWS: retroactively fix last version number + + NEWS | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit aba45eb2617c4b35168089bc9028f351732a617f +Author: Benjamin Berg <benjamin@sipsolutions.net> +Date: Tue Aug 6 00:41:52 2013 +0200 + + Create GLib.Pid in the same way on python 2 and 3 + + https://bugzilla.gnome.org/show_bug.cgi?id=705451 + + gi/_glib/pygspawn.c | 8 -------- + 1 file changed, 8 deletions(-) + +commit 2d203b7529c95ba4461a5a6d4c6b67169fabc4cf +Author: Benjamin Berg <benjamin@sipsolutions.net> +Date: Mon Aug 5 17:04:15 2013 +0200 + + Use PyLong_Type.tp_new for GLib.Pid + + For GLib.Pid the original implementation for __new__ needs to be used, + as it is able to initialize the integer correctly. + + https://bugzilla.gnome.org/show_bug.cgi?id=705451 + + gi/_glib/pygspawn.c | 1 + + tests/test_subprocess.py | 1 + + 2 files changed, 2 insertions(+) + +commit c32793dafbd52eab87b14ca064b47f5a4fb9000b +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Aug 5 14:40:38 2013 -0700 + + Add accumulator and accu_data arguments to GObject.Signal decorator + + Update __init__, __call__, and copy methods to accept and pass + accumulators and associated user data through them. Update + accumulator unittests to use Signal decorators for testing accumulator + pass throughs. Verified the __gsignals__ dictionary accepts None + as valid values for accumulator and accu_data so specialization + for these arguments is not necessary. + + https://bugzilla.gnome.org/show_bug.cgi?id=705533 + + gi/_gobject/signalhelper.py | 17 ++++++++++----- + tests/test_signal.py | 52 + ++++++++++++++++++++++++--------------------- + 2 files changed, 40 insertions(+), 29 deletions(-) + +commit 78f72654f5cb6c06e76ed9a532fc1ee328b60e50 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Aug 5 14:12:24 2013 -0700 + + Pass return values through the GObject.Signal.emit wrapper + + Return the result of GObject.emit from the Signal decorators wrapping. + Update unittest for decorated return type to use skipUnless for + Python 3. + Add test for Signal decorator return type. + + https://bugzilla.gnome.org/show_bug.cgi?id=705530 + + gi/_gobject/signalhelper.py | 2 +- + tests/test_signal.py | 37 +++++++++++++++++++++---------------- + 2 files changed, 22 insertions(+), 17 deletions(-) + +commit 08cc206afeaefd1ce50ecfd1411807225a11c8f8 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Jul 29 03:33:40 2013 -0700 + + configure.ac: post-release bump to 3.9.90 + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 2d8f5490cdc078b3e56a92deb9eca71b3fc5ef17 Author: Simon Feltman <sfeltman@src.gnome.org> Date: Mon Jul 29 02:23:02 2013 -0700 diff --git a/Makefile.in b/Makefile.in index ac8756a..5dc4686 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.2 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -1,4 +1,13 @@ -3.9.3 29-Jul-2013 +3.9.90 19-Aug-2013 + - Create GLib.Pid in the same way on python 2 and 3 (Benjamin Berg) + (#705451) + - Use PyLong_Type.tp_new for GLib.Pid (Benjamin Berg) (#705451) + - Add accumulator and accu_data arguments to GObject.Signal decorator + (Simon Feltman) (#705533) + - Pass return values through the GObject.Signal.emit wrapper + (Simon Feltman) (#705530) + +3.9.5 29-Jul-2013 - Ensure exceptions set in closure out argument marshaling are printed (Simon Feltman) (#705064) - Always raise OverflowError for marshaling integers from Python @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: PyGObject -Version: 3.9.5 +Version: 3.9.90 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/3.9/pygobject-3.9.5.tar.gz +Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.90.tar.gz Description: Python bindings for GLib and GObject Platform: POSIX, Windows Classifier: Development Status :: 5 - Production/Stable @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.13.2 -*- Autoconf -*- +# generated automatically by aclocal 1.13.3 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.13.2], [], +m4_if([$1], [1.13.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.13.2])dnl +[AM_AUTOMAKE_VERSION([1.13.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) diff --git a/config.guess b/config.guess index 120cc0d..b79252d 100755 --- a/config.guess +++ b/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2013-05-16' +timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -995,6 +995,12 @@ EOF ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2013-04-24' +timestamp='2013-08-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -257,7 +257,7 @@ case $basic_machine in | avr | avr32 \ | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ @@ -372,7 +372,7 @@ case $basic_machine in | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ @@ -794,7 +794,7 @@ case $basic_machine in os=-mingw64 ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -830,7 +830,7 @@ case $basic_machine in basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i386-pc + basic_machine=i686-pc os=-msys ;; mvs) @@ -1546,6 +1546,9 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; + c8051-*) + os=-elf + ;; hexagon-*) os=-elf ;; @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for pygobject 3.9.5. +# Generated by GNU Autoconf 2.69 for pygobject 3.9.90. # # Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pygobject' PACKAGE_TARNAME='pygobject' -PACKAGE_VERSION='3.9.5' -PACKAGE_STRING='pygobject 3.9.5' +PACKAGE_VERSION='3.9.90' +PACKAGE_STRING='pygobject 3.9.90' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject' PACKAGE_URL='https://live.gnome.org/PyGObject/' @@ -1395,7 +1395,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 3.9.5 to adapt to many kinds of systems. +\`configure' configures pygobject 3.9.90 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1465,7 +1465,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pygobject 3.9.5:";; + short | recursive ) echo "Configuration of pygobject 3.9.90:";; esac cat <<\_ACEOF @@ -1602,7 +1602,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pygobject configure 3.9.5 +pygobject configure 3.9.90 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1880,7 +1880,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 3.9.5, which was +It was created by pygobject $as_me 3.9.90, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2244,9 +2244,9 @@ $as_echo "#define PYGOBJECT_MINOR_VERSION 9" >>confdefs.h PYGOBJECT_MINOR_VERSION=9 -$as_echo "#define PYGOBJECT_MICRO_VERSION 5" >>confdefs.h +$as_echo "#define PYGOBJECT_MICRO_VERSION 90" >>confdefs.h -PYGOBJECT_MICRO_VERSION=5 +PYGOBJECT_MICRO_VERSION=90 ac_config_headers="$ac_config_headers config.h" @@ -2766,7 +2766,7 @@ fi # Define the identity of the package. PACKAGE='pygobject' - VERSION='3.9.5' + VERSION='3.9.90' cat >>confdefs.h <<_ACEOF @@ -15332,7 +15332,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 3.9.5, which was +This file was extended by pygobject $as_me 3.9.90, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15399,7 +15399,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 3.9.5 +pygobject config.status 3.9.90 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 7686553..57a4de4 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ m4_define(python3_min_ver, 3.1) dnl the pygobject version number m4_define(pygobject_major_version, 3) m4_define(pygobject_minor_version, 9) -m4_define(pygobject_micro_version, 5) +m4_define(pygobject_micro_version, 90) m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version) dnl versions of packages we require ... @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2012-10-18.11; # UTC +scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. @@ -552,6 +552,7 @@ $ { G p }' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; diff --git a/examples/Makefile.in b/examples/Makefile.in index 0f3bbec..0c05343 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.2 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/gi/Makefile.in b/gi/Makefile.in index 317ef0c..abc8c4e 100644 --- a/gi/Makefile.in +++ b/gi/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.2 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/gi/_glib/Makefile.in b/gi/_glib/Makefile.in index 3b285e9..b08e8f1 100644 --- a/gi/_glib/Makefile.in +++ b/gi/_glib/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.2 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/gi/_glib/pygspawn.c b/gi/_glib/pygspawn.c index 07adbff..72746b8 100644 --- a/gi/_glib/pygspawn.c +++ b/gi/_glib/pygspawn.c @@ -66,16 +66,8 @@ pyg_pid_tp_init(PyObject *self, PyObject *args, PyObject *kwargs) PyObject * pyg_pid_new(GPid pid) { - PYGLIB_PyLongObject *pygpid; - -#if PY_VERSION_HEX >= 0x03000000 return PyObject_CallMethod((PyObject*)&PyGPid_Type, "__new__", "Oi", &PyGPid_Type, pid); -#else - pygpid = PyObject_NEW(PyIntObject, &PyGPid_Type); - pygpid->ob_ival = pid; -#endif - return (PyObject *) pygpid; } static void @@ -262,5 +254,6 @@ pyglib_spawn_register_types(PyObject *d) PyGPid_Type.tp_methods = pyg_pid_methods; PyGPid_Type.tp_init = pyg_pid_tp_init; PyGPid_Type.tp_free = (freefunc)pyg_pid_free; + PyGPid_Type.tp_new = PYGLIB_PyLong_Type.tp_new; PYGLIB_REGISTER_TYPE(d, PyGPid_Type, "Pid"); } diff --git a/gi/_gobject/Makefile.in b/gi/_gobject/Makefile.in index e621540..b057108 100644 --- a/gi/_gobject/Makefile.in +++ b/gi/_gobject/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.2 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/gi/_gobject/signalhelper.py b/gi/_gobject/signalhelper.py index 554b724..b630158 100644 --- a/gi/_gobject/signalhelper.py +++ b/gi/_gobject/signalhelper.py @@ -102,7 +102,7 @@ class Signal(str): def emit(self, *args, **kargs): """Same as GObject.GObject.emit except there is no need to specify the signal name.""" - self.gobj.emit(str(self), *args, **kargs) + return self.gobj.emit(str(self), *args, **kargs) def __new__(cls, name='', *args, **kargs): if callable(name): @@ -110,7 +110,7 @@ class Signal(str): return str.__new__(cls, name) def __init__(self, name='', func=None, flags=_gobject.SIGNAL_RUN_FIRST, - return_type=None, arg_types=None, doc=''): + return_type=None, arg_types=None, doc='', accumulator=None, accu_data=None): """ @param name: name of signal or closure method when used as direct decorator. @type name: string or callable @@ -124,6 +124,11 @@ class Signal(str): @type arg_types: None @param doc: documentation of signal object @type doc: string + @param accumulator: accumulator method with the signature: + func(ihint, return_accu, handler_return, accu_data) -> boolean + @type accumulator: function + @param accu_data: user data passed to the accumulator + @type accu_data: object """ if func and not name: name = func.__name__ @@ -145,6 +150,8 @@ class Signal(str): self.return_type = return_type self.arg_types = arg_types self.__doc__ = doc + self.accumulator = accumulator + self.accu_data = accu_data def __get__(self, instance, owner=None): """Returns a BoundSignal when accessed on an object instance.""" @@ -170,7 +177,7 @@ class Signal(str): # Return a new value of this type since it is based on an immutable string. return type(self)(name=name, func=obj, flags=self.flags, return_type=self.return_type, arg_types=self.arg_types, - doc=self.__doc__) + doc=self.__doc__, accumulator=self.accumulator, accu_data=self.accu_data) def copy(self, newName=None): """Returns a renamed copy of the Signal.""" @@ -178,11 +185,11 @@ class Signal(str): newName = self.name return type(self)(name=newName, func=self.func, flags=self.flags, return_type=self.return_type, arg_types=self.arg_types, - doc=self.__doc__) + doc=self.__doc__, accumulator=self.accumulator, accu_data=self.accu_data) def get_signal_args(self): - """Returns a tuple of: (flags, return_type, arg_types)""" - return (self.flags, self.return_type, self.arg_types) + """Returns a tuple of: (flags, return_type, arg_types, accumulator, accu_data)""" + return (self.flags, self.return_type, self.arg_types, self.accumulator, self.accu_data) class SignalOverride(Signal): diff --git a/gi/overrides/Makefile.in b/gi/overrides/Makefile.in index 740b945..7b2d5ab 100644 --- a/gi/overrides/Makefile.in +++ b/gi/overrides/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.2 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/gi/repository/Makefile.in b/gi/repository/Makefile.in index 77db58d..72cbd29 100644 --- a/gi/repository/Makefile.in +++ b/gi/repository/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.2 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/pygtkcompat/Makefile.in b/pygtkcompat/Makefile.in index 2505c34..ab80a82 100644 --- a/pygtkcompat/Makefile.in +++ b/pygtkcompat/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.2 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/tests/Makefile.in b/tests/Makefile.in index 4fe6fd6..d9b217c 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.13.2 from Makefile.am. +# Makefile.in generated by automake 1.13.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/tests/test_signal.py b/tests/test_signal.py index 80f2986..ec13896 100644 --- a/tests/test_signal.py +++ b/tests/test_signal.py @@ -116,48 +116,52 @@ def my_accumulator(ihint, return_accu, handler_return, user_data): class Foo(GObject.GObject): - __gsignals__ = { - 'my-acc-signal': (GObject.SignalFlags.RUN_LAST, GObject.TYPE_INT, - (), my_accumulator, "accum data"), - 'my-other-acc-signal': (GObject.SignalFlags.RUN_LAST, GObject.TYPE_BOOLEAN, - (), GObject.signal_accumulator_true_handled), - 'my-acc-first-wins': (GObject.SignalFlags.RUN_LAST, GObject.TYPE_BOOLEAN, - (), GObject.signal_accumulator_first_wins) - } + my_acc_signal = GObject.Signal(return_type=GObject.TYPE_INT, + flags=GObject.SignalFlags.RUN_LAST, + accumulator=my_accumulator, + accu_data="accum data") + + my_other_acc_signal = GObject.Signal(return_type=GObject.TYPE_BOOLEAN, + flags=GObject.SignalFlags.RUN_LAST, + accumulator=GObject.signal_accumulator_true_handled) + + my_acc_first_wins = GObject.Signal(return_type=GObject.TYPE_BOOLEAN, + flags=GObject.SignalFlags.RUN_LAST, + accumulator=GObject.signal_accumulator_first_wins) class TestAccumulator(unittest.TestCase): def test_accumulator(self): inst = Foo() - inst.connect("my-acc-signal", lambda obj: 1) - inst.connect("my-acc-signal", lambda obj: 2) + inst.my_acc_signal.connect(lambda obj: 1) + inst.my_acc_signal.connect(lambda obj: 2) ## the value returned in the following handler will not be ## considered, because at this point the accumulator already ## reached its limit. - inst.connect("my-acc-signal", lambda obj: 3) - retval = inst.emit("my-acc-signal") + inst.my_acc_signal.connect(lambda obj: 3) + retval = inst.my_acc_signal.emit() self.assertEqual(retval, 3) def test_accumulator_true_handled(self): inst = Foo() - inst.connect("my-other-acc-signal", self._true_handler1) - inst.connect("my-other-acc-signal", self._true_handler2) + inst.my_other_acc_signal.connect(self._true_handler1) + inst.my_other_acc_signal.connect(self._true_handler2) ## the following handler will not be called because handler2 ## returns True, so it should stop the emission. - inst.connect("my-other-acc-signal", self._true_handler3) + inst.my_other_acc_signal.connect(self._true_handler3) self.__true_val = None - inst.emit("my-other-acc-signal") + inst.my_other_acc_signal.emit() self.assertEqual(self.__true_val, 2) def test_accumulator_first_wins(self): # First signal hit will always win inst = Foo() - inst.connect("my-acc-first-wins", self._true_handler3) - inst.connect("my-acc-first-wins", self._true_handler1) - inst.connect("my-acc-first-wins", self._true_handler2) + inst.my_acc_first_wins.connect(self._true_handler3) + inst.my_acc_first_wins.connect(self._true_handler1) + inst.my_acc_first_wins.connect(self._true_handler2) self.__true_val = None - inst.emit("my-acc-first-wins") + inst.my_acc_first_wins.emit() self.assertEqual(self.__true_val, 3) def _true_handler1(self, obj): @@ -717,11 +721,11 @@ class TestSignalDecorator(unittest.TestCase): def test_get_signal_args(self): self.assertEqual(self.Decorated.pushed.get_signal_args(), - (GObject.SignalFlags.RUN_FIRST, None, tuple())) + (GObject.SignalFlags.RUN_FIRST, None, tuple(), None, None)) self.assertEqual(self.Decorated.pulled.get_signal_args(), - (GObject.SignalFlags.RUN_LAST, None, tuple())) + (GObject.SignalFlags.RUN_LAST, None, tuple(), None, None)) self.assertEqual(self.Decorated.stomped.get_signal_args(), - (GObject.SignalFlags.RUN_FIRST, None, (int,))) + (GObject.SignalFlags.RUN_FIRST, None, (int,), None, None)) def test_closures_called(self): decorated = self.Decorated() @@ -900,28 +904,33 @@ class AnnotatedSignalClass(GObject.GObject): """ +@unittest.skipUnless(sys.version_info >= (3, 0), + 'Argument annotations require Python 3') class TestPython3Signals(unittest.TestCase): AnnotatedClass = None def setUp(self): - if sys.version_info >= (3, 0): - exec(annotated_class_code, globals(), globals()) - self.assertTrue('AnnotatedSignalClass' in globals()) - self.AnnotatedClass = globals()['AnnotatedSignalClass'] + exec(annotated_class_code, globals(), globals()) + self.assertTrue('AnnotatedSignalClass' in globals()) + self.AnnotatedClass = globals()['AnnotatedSignalClass'] def test_annotations(self): - if self.AnnotatedClass: - self.assertEqual(signalhelper.get_signal_annotations(self.AnnotatedClass.sig1.func), - (None, (int, float))) - self.assertEqual(signalhelper.get_signal_annotations(self.AnnotatedClass.sig2_with_return.func), - (str, (int, float))) - - self.assertEqual(self.AnnotatedClass.sig2_with_return.get_signal_args(), - (GObject.SignalFlags.RUN_LAST, str, (int, float))) - self.assertEqual(self.AnnotatedClass.sig2_with_return.arg_types, - (int, float)) - self.assertEqual(self.AnnotatedClass.sig2_with_return.return_type, - str) + self.assertEqual(signalhelper.get_signal_annotations(self.AnnotatedClass.sig1.func), + (None, (int, float))) + self.assertEqual(signalhelper.get_signal_annotations(self.AnnotatedClass.sig2_with_return.func), + (str, (int, float))) + + self.assertEqual(self.AnnotatedClass.sig2_with_return.get_signal_args(), + (GObject.SignalFlags.RUN_LAST, str, (int, float), None, None)) + self.assertEqual(self.AnnotatedClass.sig2_with_return.arg_types, + (int, float)) + self.assertEqual(self.AnnotatedClass.sig2_with_return.return_type, + str) + + def test_emit_return(self): + obj = self.AnnotatedClass() + self.assertEqual(obj.sig2_with_return.emit(1, 2.0), + 'test') class TestSignalModuleLevelFunctions(unittest.TestCase): diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py index 26308e8..ef4c35e 100644 --- a/tests/test_subprocess.py +++ b/tests/test_subprocess.py @@ -107,6 +107,7 @@ class TestProcess(unittest.TestCase): self.assertEqual(stdin, None) self.assertEqual(stdout, None) self.assertEqual(stderr, None) + self.assertNotEqual(pid, 0) pid.close() id = GLib.child_watch_add(GLib.PRIORITY_HIGH, pid, cb, 12345) self.assertEqual(self.loop.get_context().find_source_by_id(id).priority, |