diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:41:46 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:41:50 +0900 |
commit | 5a89ec21697bd9e08c9102b2a7b6c60b4652e66c (patch) | |
tree | e9e20b8b8764a0dd9f82ea1e574ec777b9fa67f6 | |
parent | b0a50e7198747efb1d09dca4a1778148beac9576 (diff) | |
download | pygobject2-5a89ec21697bd9e08c9102b2a7b6c60b4652e66c.tar.gz pygobject2-5a89ec21697bd9e08c9102b2a7b6c60b4652e66c.tar.bz2 pygobject2-5a89ec21697bd9e08c9102b2a7b6c60b4652e66c.zip |
Imported Upstream version 3.13.1
Change-Id: If4647282414d88e0de6e0f879ba00a88843f7510
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
-rw-r--r-- | ChangeLog | 174 | ||||
-rw-r--r-- | NEWS | 19 | ||||
-rw-r--r-- | PKG-INFO | 4 | ||||
-rwxr-xr-x | configure | 34 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | gi/importer.py | 9 | ||||
-rw-r--r-- | gi/overrides/GIMarshallingTests.py | 4 | ||||
-rw-r--r-- | gi/overrides/GLib.py | 6 | ||||
-rw-r--r-- | gi/overrides/Gdk.py | 11 | ||||
-rw-r--r-- | gi/overrides/Gio.py | 4 | ||||
-rw-r--r-- | gi/overrides/Gtk.py | 12 | ||||
-rw-r--r-- | gi/overrides/Pango.py | 3 | ||||
-rw-r--r-- | gi/pygi-boxed.c | 6 | ||||
-rw-r--r-- | gi/pygi-value.c | 23 | ||||
-rw-r--r-- | gi/types.py | 2 | ||||
-rw-r--r-- | pygtkcompat/pygtkcompat.py | 8 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/Makefile.in | 2 | ||||
-rw-r--r-- | tests/test_everything.py | 1 | ||||
-rw-r--r-- | tests/test_gi.py | 15 | ||||
-rw-r--r-- | tests/test_import_machinery.py (renamed from tests/test_overrides.py) | 18 | ||||
-rw-r--r-- | tests/test_iochannel.py | 2 | ||||
-rw-r--r-- | tests/test_option.py | 2 | ||||
-rw-r--r-- | tests/test_overrides_gdk.py | 17 | ||||
-rw-r--r-- | tests/test_repository.py | 4 | ||||
-rw-r--r-- | tests/test_signal.py | 28 | ||||
-rw-r--r-- | tests/testhelpermodule.c | 3 |
27 files changed, 288 insertions, 131 deletions
@@ -1,71 +1,57 @@ -commit 086c10133d6d9ac155e3a7fee7dde198aea1343d -Author: Simon Feltman <sfeltman@src.gnome.org> -Date: Fri May 2 21:36:25 2014 -0700 - - PEP8 fixes +commit 3a2bfc8bf01fcae386355bc3652780e198e54d49 +Author: Christoph Reiter <reiter.christoph@gmail.com> +Date: Mon Apr 14 23:33:52 2014 +0200 - Use infix 'not' instead of prefixed. - Don't use double comments (##). - Use space between comment and text. - Un-comment tests that now work. - Move broken (and won't fix) implicit int64 signal tests into - a new skipped test function. + Raise TypeError if arguments are passed to Boxed.__init__ - gi/overrides/GIMarshallingTests.py | 4 ++-- - gi/overrides/Gio.py | 4 ++-- - gi/overrides/Gtk.py | 6 +++--- - gi/types.py | 2 +- - pygtkcompat/pygtkcompat.py | 4 ++-- - tests/test_everything.py | 1 - - tests/test_gi.py | 9 +++------ - tests/test_iochannel.py | 2 +- - tests/test_option.py | 2 +- - tests/test_signal.py | 28 +++++++++++++--------------- - 10 files changed, 28 insertions(+), 34 deletions(-) + This is a partial revert of + https://git.gnome.org/browse/pygobject/commit/?id=2f2069c9efcd8 + which removed a type check in __new__. This adds it back + into __init__. Overrides which define __new__ now have to + filter out any arguments in __init__ and not the other way + around, which is a bit less surprising in the common case. -commit 382bb7e9e84ae142d18832409e4f5e969876c84c -Author: Simon Feltman <sfeltman@src.gnome.org> -Date: Mon May 26 03:01:13 2014 -0700 + https://bugzilla.gnome.org/show_bug.cgi?id=727810 - Python 3.4 make check fixes + gi/overrides/GLib.py | 6 ++++++ + gi/overrides/Gtk.py | 6 ++++++ + gi/overrides/Pango.py | 3 +++ + gi/pygi-boxed.c | 6 ++++++ + tests/test_gi.py | 4 ++++ + 5 files changed, 25 insertions(+) - Use unittest.skip() instead of unittest.expectedFailure() for - tests which - pass in GI 1.39.0. This is needed to get rid of unexpected successes - which - fail unittesting in Python 3.4. - Silence deprecation warning when using imp.reload. +commit 906977047df2fb2f394410e4ebf360b69af8dcfe +Author: Christoph Reiter <reiter.christoph@gmail.com> +Date: Mon Apr 14 15:40:50 2014 +0200 - https://bugzilla.gnome.org/show_bug.cgi?id=730411 + Gdk.Event: Override __setattr__ to set fields based on the event type - pygtkcompat/pygtkcompat.py | 4 +++- - tests/test_gi.py | 2 +- - tests/test_repository.py | 4 ++-- - 3 files changed, 6 insertions(+), 4 deletions(-) + Pass the setting of attributes through to the underlying union based + on event type. This mirrors the logic in __getattr__. -commit 458ea7555445ec8f0e57c009ca0de985bcfa4d53 -Author: Simon Feltman <sfeltman@src.gnome.org> -Date: Mon Apr 14 16:23:24 2014 -0700 + https://bugzilla.gnome.org/show_bug.cgi?id=727810 - configure.ac: post release version bump to 3.12.2 + gi/overrides/Gdk.py | 7 +++++++ + tests/test_overrides_gdk.py | 13 ++++++++++--- + 2 files changed, 17 insertions(+), 3 deletions(-) - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) +commit 78a0508a4d40e3723b36297ba2d42889dabc1cdd +Author: Christoph Reiter <reiter.christoph@gmail.com> +Date: Mon Apr 14 13:06:02 2014 +0200 -commit 193b114a6425e5dba0c91d17227a050529ffe40b -Author: Simon Feltman <sfeltman@src.gnome.org> -Date: Mon Apr 14 16:15:48 2014 -0700 + Gdk.Event: Include GdkEventType in __repr__ - release 3.12.1 + https://bugzilla.gnome.org/show_bug.cgi?id=727810 - NEWS | 5 +++++ - 1 file changed, 5 insertions(+) + gi/overrides/Gdk.py | 4 ++++ + tests/test_overrides_gdk.py | 4 ++++ + 2 files changed, 8 insertions(+) -commit 6638b188abed038b4dfa2589826ef36a2145b957 +commit 23965455f060793ffcbc0d8288527d41a667579c Author: Simon Feltman <sfeltman@src.gnome.org> Date: Mon Apr 14 15:10:01 2014 -0700 - Fix crash with type checking invalid GObject arguments + Fix crash with type checking for GObject arguments Ensure we have a valid GObject before attempting to call g_type_is_a. Swap conditional blocks to make if condition more readable. @@ -76,7 +62,7 @@ Date: Mon Apr 14 15:10:01 2014 -0700 tests/test_object_marshaling.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 9 deletions(-) -commit 22951466aee024f6199963a4f300b36c8e61c418 +commit 2e853f6a31636d6a26ce91eb30be5bb0326474b1 Author: Paolo Borelli <pborelli@gnome.org> Date: Sun Mar 30 18:27:59 2014 +0200 @@ -85,15 +71,93 @@ Date: Sun Mar 30 18:27:59 2014 +0200 gi/pygi-closure.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -commit db797ce5b4fb81bff10434fe66ad627dfdd4e762 +commit f9e504c79c5ef6e1938e4db5b49115689b9f5c3c Author: Simon Feltman <sfeltman@src.gnome.org> -Date: Mon Mar 24 04:27:51 2014 -0700 +Date: Fri Mar 28 19:51:58 2014 -0700 - configure.ac: post release version bump to 3.12.1 + configure.ac: Update PyGObject wiki link in AC_INIT configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) +commit ee84b5a2c83d88436aec6b62e7a271a3525569e0 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Mar 24 18:57:56 2014 -0700 + + Ignore GValueArray deprecations + + Wrap calls to GValueArray related calls with + G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS. + Although GValueArray is deprecated, we still need to support the + marshaling of + them in PyGObject. The deprecations add noise to the build processes + in which + new warnings could be lost. Essentially losing the element of surprise + a new + warning should have on maintainers. + + gi/pygi-value.c | 23 ++++++++++++++++++++--- + tests/testhelpermodule.c | 3 +++ + 2 files changed, 23 insertions(+), 3 deletions(-) + +commit ac8b59ee335967efef974ab0aa89128ade9f3d0c +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Mar 24 18:09:10 2014 -0700 + + Raise ImportError when importing modules not found in repository + + Raise an ImportError with extra information noting the typelib was not + found. This removes the need to log a similar message which adds + output + noise when attempting controlled imports within try/except statements. + In Python 2, the additional information is lost but in Python 3 it + shows up. + + https://bugzilla.gnome.org/show_bug.cgi?id=726877 + + gi/importer.py | 9 ++++----- + tests/test_import_machinery.py | 18 ++++++++++++++++++ + 2 files changed, 22 insertions(+), 5 deletions(-) + +commit e604ada06a8ef8f9a06f0638cf183cfeacdc63a9 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Mar 24 18:04:27 2014 -0700 + + tests: Rename test_overrides to test_import_machinery + + Rename this test to better suit the contents of the file. This + also gives + us a more concise location to grow other tests related to import + machinery + internals. + + https://bugzilla.gnome.org/show_bug.cgi?id=726877 + + tests/Makefile.am | 2 +- + tests/test_import_machinery.py | 58 + ++++++++++++++++++++++++++++++++++++++++++ + tests/test_overrides.py | 58 + ------------------------------------------ + 3 files changed, 59 insertions(+), 59 deletions(-) + +commit a863e5ec0ac27de49a0ae261fd3a78745cfe84a0 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Mar 24 04:39:47 2014 -0700 + + HACKING: Update branch creation instructions to include -b + + HACKING | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 1012cfd58c1d41dd6b040a2d14f395e5578f5e79 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Mar 24 04:35:52 2014 -0700 + + configure.ac: post release version bump to 3.13.1 + + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + commit 45eda91eac2f6c8ab1a5c38808f96de760196e90 Author: Simon Feltman <sfeltman@src.gnome.org> Date: Mon Mar 24 03:35:21 2014 -0700 @@ -1,11 +1,16 @@ -3.12.2 26-May-2014 - - PEP8 fixes (Simon Feltman) - - Python 3.4 make check fixes (Simon Feltman) (#730411) - -3.12.1 14-Apr-2014 - - Fix crash with type checking invalid GObject arguments - (Simon Feltman) (#727604) +3.13.1 28-Apr-2014 + - Raise TypeError if arguments are passed to Boxed.__init__ + (Christoph Reiter) (#727810) + - Gdk.Event: Override __setattr__ to set fields based on the event type + (Christoph Reiter) (#727810) + - Gdk.Event: Include GdkEventType in __repr__ (Christoph Reiter) (#727810) + - Fix crash with type checking for GObject arguments (Simon Feltman) (#727604) - Do not leak info of destroy notify (Paolo Borelli) + - Ignore GValueArray deprecations (Simon Feltman) + - Raise ImportError when importing modules not found in repository + (Simon Feltman) (#726877) + - tests: Rename test_overrides to test_import_machinery + (Simon Feltman) (#726877) 3.12.0 24-Mar-2014 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: PyGObject -Version: 3.12.2 +Version: 3.13.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/3.12/pygobject-3.12.2.tar.gz +Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.13/pygobject-3.13.1.tar.gz Description: Python bindings for GLib and GObject Platform: POSIX, Windows Classifier: Development Status :: 5 - Production/Stable @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for pygobject 3.12.2. +# Generated by GNU Autoconf 2.69 for pygobject 3.13.1. # # Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>. # @@ -591,10 +591,10 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pygobject' PACKAGE_TARNAME='pygobject' -PACKAGE_VERSION='3.12.2' -PACKAGE_STRING='pygobject 3.12.2' +PACKAGE_VERSION='3.13.1' +PACKAGE_STRING='pygobject 3.13.1' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject' -PACKAGE_URL='https://live.gnome.org/PyGObject/' +PACKAGE_URL='https://wiki.gnome.org/Projects/PyGObject/' ac_unique_file="gi/gimodule.c" # Factoring default headers for most tests. @@ -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.12.2 to adapt to many kinds of systems. +\`configure' configures pygobject 3.13.1 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.12.2:";; + short | recursive ) echo "Configuration of pygobject 3.13.1:";; esac cat <<\_ACEOF @@ -1540,7 +1540,7 @@ Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>. -pygobject home page: <https://live.gnome.org/PyGObject/>. +pygobject home page: <https://wiki.gnome.org/Projects/PyGObject/>. _ACEOF ac_status=$? fi @@ -1603,7 +1603,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pygobject configure 3.12.2 +pygobject configure 3.13.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1881,7 +1881,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.12.2, which was +It was created by pygobject $as_me 3.13.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2240,14 +2240,14 @@ $as_echo "#define PYGOBJECT_MAJOR_VERSION 3" >>confdefs.h PYGOBJECT_MAJOR_VERSION=3 -$as_echo "#define PYGOBJECT_MINOR_VERSION 12" >>confdefs.h +$as_echo "#define PYGOBJECT_MINOR_VERSION 13" >>confdefs.h -PYGOBJECT_MINOR_VERSION=12 +PYGOBJECT_MINOR_VERSION=13 -$as_echo "#define PYGOBJECT_MICRO_VERSION 2" >>confdefs.h +$as_echo "#define PYGOBJECT_MICRO_VERSION 1" >>confdefs.h -PYGOBJECT_MICRO_VERSION=2 +PYGOBJECT_MICRO_VERSION=1 ac_config_headers="$ac_config_headers config.h" @@ -2767,7 +2767,7 @@ fi # Define the identity of the package. PACKAGE='pygobject' - VERSION='3.12.2' + VERSION='3.13.1' cat >>confdefs.h <<_ACEOF @@ -15370,7 +15370,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.12.2, which was +This file was extended by pygobject $as_me 3.13.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15431,13 +15431,13 @@ Configuration commands: $config_commands Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>. -pygobject home page: <https://live.gnome.org/PyGObject/>." +pygobject home page: <https://wiki.gnome.org/Projects/PyGObject/>." _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.12.2 +pygobject config.status 3.13.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index bd9f271..a21c489 100644 --- a/configure.ac +++ b/configure.ac @@ -17,8 +17,8 @@ m4_define(python3_min_ver, 3.1) dnl the pygobject version number m4_define(pygobject_major_version, 3) -m4_define(pygobject_minor_version, 12) -m4_define(pygobject_micro_version, 2) +m4_define(pygobject_minor_version, 13) +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 ... @@ -30,7 +30,7 @@ m4_define(gio_required_version, 2.38.0) AC_INIT([pygobject],[pygobject_version], [http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject], - [pygobject],[https://live.gnome.org/PyGObject/]) + [pygobject],[https://wiki.gnome.org/Projects/PyGObject/]) AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .") AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([gi/gimodule.c]) diff --git a/gi/importer.py b/gi/importer.py index aa95cf6..cea0f8b 100644 --- a/gi/importer.py +++ b/gi/importer.py @@ -21,7 +21,6 @@ # USA from __future__ import absolute_import -import logging import sys from ._gi import Repository @@ -47,11 +46,11 @@ class DynamicImporter(object): if path != self.path: return - if not repository.enumerate_versions(namespace): - logging.error('Could not find any typelib for %s', namespace) - return None - else: + if repository.enumerate_versions(namespace): return self + else: + raise ImportError('cannot import name %s, ' + 'introspection typelib not found' % namespace) def load_module(self, fullname): if fullname in sys.modules: diff --git a/gi/overrides/GIMarshallingTests.py b/gi/overrides/GIMarshallingTests.py index b675adf..cc967b4 100644 --- a/gi/overrides/GIMarshallingTests.py +++ b/gi/overrides/GIMarshallingTests.py @@ -53,13 +53,13 @@ class OverridesObject(GIMarshallingTests.OverridesObject): def __init__(self, long_): GIMarshallingTests.OverridesObject.__init__(self) # FIXME: doesn't work yet - # self.long_ = long_ + #self.long_ = long_ @classmethod def new(cls, long_): self = GIMarshallingTests.OverridesObject.new() # FIXME: doesn't work yet - # self.long_ = long_ + #self.long_ = long_ return self def method(self): diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py index c541004..0e8f694 100644 --- a/gi/overrides/GLib.py +++ b/gi/overrides/GLib.py @@ -547,6 +547,9 @@ class Source(GLib.Source): setattr(source, '__pygi_custom_source', True) return source + def __init__(self, *args, **kwargs): + return super(Source, self).__init__() + def __del__(self): if hasattr(self, '__pygi_custom_source'): self.unref() @@ -710,6 +713,9 @@ class IOChannel(GLib.IOChannel): return GLib.IOChannel.win32_new_fd(hwnd) raise TypeError('either a valid file descriptor, file name, or window handle must be supplied') + def __init__(self, *args, **kwargs): + return super(IOChannel, self).__init__() + def read(self, max_count=-1): return io_channel_read(self, max_count) diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py index 9d0ba7d..95030f8 100644 --- a/gi/overrides/Gdk.py +++ b/gi/overrides/Gdk.py @@ -202,6 +202,17 @@ class Event(Gdk.Event): else: raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name)) + def __setattr__(self, name, value): + real_event = getattr(self, '_UNION_MEMBERS').get(self.type) + if real_event: + setattr(getattr(self, real_event), name, value) + else: + Gdk.Event.__setattr__(self, name, value) + + def __repr__(self): + base_repr = Gdk.Event.__repr__(self).strip("><") + return "<%s type=%r>" % (base_repr, self.type) + Event = override(Event) __all__.append('Event') diff --git a/gi/overrides/Gio.py b/gi/overrides/Gio.py index e646821..5a5dd2f 100644 --- a/gi/overrides/Gio.py +++ b/gi/overrides/Gio.py @@ -82,14 +82,14 @@ class Settings(Gio.Settings): def __getitem__(self, key): # get_value() aborts the program on an unknown key - if key not in self: + if not key in self: raise KeyError('unknown key: %r' % (key,)) return self.get_value(key).unpack() def __setitem__(self, key, value): # set_value() aborts the program on an unknown key - if key not in self: + if not key in self: raise KeyError('unknown key: %r' % (key,)) # determine type string of this key diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py index 8887da8..df55c2d 100644 --- a/gi/overrides/Gtk.py +++ b/gi/overrides/Gtk.py @@ -1115,17 +1115,20 @@ class TreePath(Gtk.TreePath): except TypeError: raise TypeError("could not parse subscript '%s' as a tree path" % path) + def __init__(self, *args, **kwargs): + super(TreePath, self).__init__() + def __str__(self): return self.to_string() def __lt__(self, other): - return other is not None and self.compare(other) < 0 + return not other is None and self.compare(other) < 0 def __le__(self, other): - return other is not None and self.compare(other) <= 0 + return not other is None and self.compare(other) <= 0 def __eq__(self, other): - return other is not None and self.compare(other) == 0 + return not other is None and self.compare(other) == 0 def __ne__(self, other): return other is None or self.compare(other) != 0 @@ -1466,6 +1469,9 @@ class IconSet(Gtk.IconSet): iconset = Gtk.IconSet.__new__(cls) return iconset + def __init__(self, *args, **kwargs): + return super(IconSet, self).__init__() + IconSet = override(IconSet) __all__.append('IconSet') diff --git a/gi/overrides/Pango.py b/gi/overrides/Pango.py index 0f7c484..365e47b 100644 --- a/gi/overrides/Pango.py +++ b/gi/overrides/Pango.py @@ -34,6 +34,9 @@ class FontDescription(Pango.FontDescription): else: return Pango.FontDescription.__new__(cls) + def __init__(self, *args, **kwargs): + return super(FontDescription, self).__init__() + FontDescription = override(FontDescription) __all__.append('FontDescription') diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c index 06324fd..c52858b 100644 --- a/gi/pygi-boxed.c +++ b/gi/pygi-boxed.c @@ -123,6 +123,12 @@ _boxed_init (PyObject *self, PyObject *args, PyObject *kwargs) { + static char *kwlist[] = { NULL }; + + if (!PyArg_ParseTupleAndKeywords (args, kwargs, "", kwlist)) { + return -1; + } + /* Don't call PyGBoxed's init, which raises an exception. */ return 0; } diff --git a/gi/pygi-value.c b/gi/pygi-value.c index f2cc27b..8235116 100644 --- a/gi/pygi-value.c +++ b/gi/pygi-value.c @@ -147,6 +147,11 @@ _pygi_argument_from_g_value(const GValue *value, } +/* Ignore g_value_array deprecations. Although they are deprecated, + * we still need to support the marshaling of them in PyGObject. + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static int pyg_value_array_from_pyobject(GValue *value, PyObject *obj, @@ -213,6 +218,8 @@ pyg_value_array_from_pyobject(GValue *value, return 0; } +G_GNUC_END_IGNORE_DEPRECATIONS + static int pyg_array_from_pyobject(GValue *value, PyObject *obj) @@ -489,6 +496,11 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj) break; case G_TYPE_BOXED: { PyGTypeMarshal *bm; + gboolean holds_value_array; + + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + holds_value_array = G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY); + G_GNUC_END_IGNORE_DEPRECATIONS if (obj == Py_None) g_value_set_boxed(value, NULL); @@ -510,9 +522,9 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj) g_value_take_boxed (value, n_value); return pyg_value_from_pyobject_with_error (n_value, obj); } - else if (PySequence_Check(obj) && - G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY)) + else if (PySequence_Check(obj) && holds_value_array) return pyg_value_array_from_pyobject(value, obj, NULL); + else if (PySequence_Check(obj) && G_VALUE_HOLDS(value, G_TYPE_ARRAY)) return pyg_array_from_pyobject(value, obj); @@ -718,6 +730,11 @@ pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed) g_value_get_pointer(value)); case G_TYPE_BOXED: { PyGTypeMarshal *bm; + gboolean holds_value_array; + + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + holds_value_array = G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY); + G_GNUC_END_IGNORE_DEPRECATIONS if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) { PyObject *ret = (PyObject *)g_value_dup_boxed(value); @@ -729,7 +746,7 @@ pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed) } else if (G_VALUE_HOLDS(value, G_TYPE_VALUE)) { GValue *n_value = g_value_get_boxed (value); return pyg_value_as_pyobject(n_value, copy_boxed); - } else if (G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY)) { + } else if (holds_value_array) { GValueArray *array = (GValueArray *) g_value_get_boxed(value); PyObject *ret = PyList_New(array->n_values); int i; diff --git a/gi/types.py b/gi/types.py index 6007e53..e6e3903 100644 --- a/gi/types.py +++ b/gi/types.py @@ -182,7 +182,7 @@ class _GObjectMetaBase(type): cls._type_register(cls.__dict__) def _type_register(cls, namespace): - # don't register the class if already registered + ## don't register the class if already registered if '__gtype__' in namespace: return diff --git a/pygtkcompat/pygtkcompat.py b/pygtkcompat/pygtkcompat.py index 7ee2de4..d5b7b94 100644 --- a/pygtkcompat/pygtkcompat.py +++ b/pygtkcompat/pygtkcompat.py @@ -38,10 +38,8 @@ import warnings try: # Python 3 from collections import UserList + from imp import reload UserList # pyflakes - with warnings.catch_warnings(): - warnings.simplefilter('ignore') - from imp import reload except ImportError: # Python 2 ships that in a different module from UserList import UserList @@ -359,10 +357,10 @@ def enable_gtk(version='3.0'): except AttributeError: pass - # AccelGroup + #AccelGroup Gtk.AccelGroup.connect_group = Gtk.AccelGroup.connect - # StatusIcon + #StatusIcon Gtk.status_icon_position_menu = Gtk.StatusIcon.position_menu Gtk.StatusIcon.set_tooltip = Gtk.StatusIcon.set_tooltip_text diff --git a/tests/Makefile.am b/tests/Makefile.am index d69bbad..3468740 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -102,7 +102,7 @@ EXTRA_DIST = \ test_everything.py \ test_gi.py \ test_gdbus.py \ - test_overrides.py \ + test_import_machinery.py \ test_overrides_glib.py \ test_overrides_pango.py \ test_overrides_gdk.py \ diff --git a/tests/Makefile.in b/tests/Makefile.in index d37cfda..5b94b34 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -400,7 +400,7 @@ EXTRA_DIST = \ test_everything.py \ test_gi.py \ test_gdbus.py \ - test_overrides.py \ + test_import_machinery.py \ test_overrides_glib.py \ test_overrides_pango.py \ test_overrides_gdk.py \ diff --git a/tests/test_everything.py b/tests/test_everything.py index cc79dc3..0cd1804 100644 --- a/tests/test_everything.py +++ b/tests/test_everything.py @@ -15,6 +15,7 @@ try: except ImportError: has_cairo = False +#import gi from gi.repository import GObject from gi.repository import GLib from gi.repository import Gio diff --git a/tests/test_gi.py b/tests/test_gi.py index a008ce7..9846440 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -61,8 +61,9 @@ class Sequence(object): class TestConstant(unittest.TestCase): - def test_constant_utf8(self): - self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8) +# Blocked by https://bugzilla.gnome.org/show_bug.cgi?id=595773 +# def test_constant_utf8(self): +# self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8) def test_constant_number(self): self.assertEqual(CONSTANT_NUMBER, GIMarshallingTests.CONSTANT_NUMBER) @@ -1851,6 +1852,10 @@ class TestStructure(unittest.TestCase): self.assertEqual(struct.long_, 42) self.assertEqual(struct.string_, 'hello') + def test_union_init(self): + self.assertRaises(TypeError, GIMarshallingTests.Union, 42) + self.assertRaises(TypeError, GIMarshallingTests.Union, f=42) + def test_union(self): union = GIMarshallingTests.Union() @@ -2004,7 +2009,7 @@ class TestGObject(unittest.TestCase): GIMarshallingTests.Object.none_inout(GIMarshallingTests.SubObject(int=42)) - @unittest.skip('https://bugzilla.gnome.org/show_bug.cgi?id=709796') + @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=709796 def test_object_full_inout(self): # Using gimarshallingtests.c from GI versions > 1.38.0 will show this # test as an "unexpected success" due to reference leak fixes in that file. @@ -2519,7 +2524,9 @@ class TestOverrides(unittest.TestCase): # not overridden self.assertEqual(GIMarshallingTests.SubObject.__module__, 'gi.repository.GIMarshallingTests') - self.assertEqual(GObject.InitiallyUnowned.__module__, 'gi.repository.GObject') + # FIXME: does not work with TEST_NAMES='test_thread test_gi.TestOverrides', + # it is importlib._bootstrap then + #self.assertEqual(GObject.InitiallyUnowned.__module__, 'gi.repository.GObject') class TestDir(unittest.TestCase): diff --git a/tests/test_overrides.py b/tests/test_import_machinery.py index e1af1f1..42b4bf8 100644 --- a/tests/test_overrides.py +++ b/tests/test_import_machinery.py @@ -1,6 +1,7 @@ # -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab +import sys import unittest import gi.overrides @@ -56,3 +57,20 @@ class TestModule(unittest.TestCase): # Restore the previous cache gi.module._introspection_modules = old_modules + + +class TestImporter(unittest.TestCase): + def test_invalid_repository_module_name(self): + with self.assertRaises(ImportError) as context: + from gi.repository import InvalidGObjectRepositoryModuleName + InvalidGObjectRepositoryModuleName # pyflakes + + exception_string = str(context.exception) + + self.assertTrue('InvalidGObjectRepositoryModuleName' in exception_string) + + # The message of the custom exception in gi/importer.py is eaten in Python 2.7 + if sys.version_info.major < 3: + self.assertTrue('introspection typelib' not in exception_string) + else: + self.assertTrue('introspection typelib' in exception_string) diff --git a/tests/test_iochannel.py b/tests/test_iochannel.py index 259171b..0cc1b4b 100644 --- a/tests/test_iochannel.py +++ b/tests/test_iochannel.py @@ -108,7 +108,7 @@ second line ch.seek(2, 2) # SEEK_END # FIXME: does not work currently - # self.assertEqual(ch.read(2), b'n!') + #self.assertEqual(ch.read(2), b'n!') # invalid whence value self.assertRaises(ValueError, ch.seek, 0, 3) diff --git a/tests/test_option.py b/tests/test_option.py index fe25746..2900edd 100644 --- a/tests/test_option.py +++ b/tests/test_option.py @@ -71,7 +71,7 @@ class TestOption(unittest.TestCase): def test_parse_args_double_dash(self): options, args = self.parser.parse_args( ["test_option.py", "--", "-xxx"]) - # self.assertEqual(args, ["-xxx"]) + #self.assertEqual(args, ["-xxx"]) def test_parse_args_group(self): group = self._create_group() diff --git a/tests/test_overrides_gdk.py b/tests/test_overrides_gdk.py index 90e2fde..60d5ae4 100644 --- a/tests/test_overrides_gdk.py +++ b/tests/test_overrides_gdk.py @@ -66,14 +66,25 @@ class TestGdk(unittest.TestCase): self.assertEqual(event.type, Gdk.EventType.CONFIGURE) self.assertEqual(event.send_event, 0) + event = Gdk.Event() + event.type = Gdk.EventType.SCROLL + self.assertRaises(AttributeError, lambda: getattr(event, 'foo_bar')) + + def test_event_setattr(self): event = Gdk.Event.new(Gdk.EventType.DRAG_MOTION) event.x_root, event.y_root = 0, 5 + self.assertEqual(event.dnd.x_root, 0) + self.assertEqual(event.dnd.y_root, 5) self.assertEqual(event.x_root, 0) self.assertEqual(event.y_root, 5) - event = Gdk.Event() - event.type = Gdk.EventType.SCROLL - self.assertRaises(AttributeError, lambda: getattr(event, 'foo_bar')) + # this used to work, keep it that way + self.assertFalse(hasattr(event, "foo_bar")) + event.foo_bar = 42 + + def test_event_repr(self): + event = Gdk.Event.new(Gdk.EventType.CONFIGURE) + self.assertTrue("CONFIGURE" in repr(event)) def test_event_structures(self): def button_press_cb(button, event): diff --git a/tests/test_repository.py b/tests/test_repository.py index 39722ef..c02581c 100644 --- a/tests/test_repository.py +++ b/tests/test_repository.py @@ -213,7 +213,7 @@ class Test(unittest.TestCase): self.assertEqual(func_info.get_return_type().get_tag(), GIRepository.TypeTag.VOID) self.assertRaises(AttributeError, func_info.get_return_attribute, '_not_an_attr') - @unittest.skip('https://bugzilla.gnome.org/show_bug.cgi?id=709462') + @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=709462 @unittest.skipUnless(has_cairo, 'Regress needs cairo') def test_signal_info(self): repo.require('Regress') @@ -231,7 +231,7 @@ class Test(unittest.TestCase): self.assertFalse(sig_info.true_stops_emit()) self.assertEqual(sig_info.get_flags(), sig_flags) - @unittest.skip('https://bugzilla.gnome.org/show_bug.cgi?id=709462') + @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=709462 @unittest.skipUnless(has_cairo, 'Regress needs cairo') def test_notify_signal_info_with_obj(self): repo.require('Regress') diff --git a/tests/test_signal.py b/tests/test_signal.py index 80d4ac5..429afc9 100644 --- a/tests/test_signal.py +++ b/tests/test_signal.py @@ -136,9 +136,9 @@ class TestAccumulator(unittest.TestCase): inst = Foo() 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. + ## the value returned in the following handler will not be + ## considered, because at this point the accumulator already + ## reached its limit. inst.my_acc_signal.connect(lambda obj: 3) retval = inst.my_acc_signal.emit() self.assertEqual(retval, 3) @@ -147,8 +147,8 @@ class TestAccumulator(unittest.TestCase): inst = Foo() 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. + ## the following handler will not be called because handler2 + ## returns True, so it should stop the emission. inst.my_other_acc_signal.connect(self._true_handler3) self.__true_val = None inst.my_other_acc_signal.emit() @@ -629,20 +629,20 @@ class _TestCMarshaller: rv = self.obj.emit("test-gvalue", v) self.assertEqual(rv, GObject.G_MAXINT64) + # implicit int64 + # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775 + #rv = self.obj.emit("test-gvalue", GObject.G_MAXINT64) + #self.assertEqual(rv, GObject.G_MAXINT64) + # explicit uint64 v = GObject.Value(GObject.TYPE_UINT64, GObject.G_MAXUINT64) rv = self.obj.emit("test-gvalue", v) self.assertEqual(rv, GObject.G_MAXUINT64) - @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=705291 - def test_gvalue_implicit_int64(self): - # implicit int64 - rv = self.obj.emit("test-gvalue", GObject.G_MAXINT64) - self.assertEqual(rv, GObject.G_MAXINT64) - # implicit uint64 - rv = self.obj.emit("test-gvalue", GObject.G_MAXUINT64) - self.assertEqual(rv, GObject.G_MAXUINT64) + # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775 + #rv = self.obj.emit("test-gvalue", GObject.G_MAXUINT64) + #self.assertEqual(rv, GObject.G_MAXUINT64) def test_gvalue_ret(self): self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_INT), @@ -705,6 +705,7 @@ class TestSignalDecorator(unittest.TestCase): @GObject.SignalOverride def notify(self, *args, **kargs): self.overridden_closure_called = True + #GObject.GObject.notify(self, *args, **kargs) def on_notify(self, obj, prop): self.notify_called = True @@ -762,6 +763,7 @@ class TestSignalDecorator(unittest.TestCase): obj = self.DecoratedOverride() obj.connect("notify", obj.on_notify) self.assertEqual(obj.value, 0) + #obj.notify.emit() obj.value = 1 self.assertEqual(obj.value, 1) self.assertTrue(obj.overridden_closure_called) diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c index 9b198c3..66c0155 100644 --- a/tests/testhelpermodule.c +++ b/tests/testhelpermodule.c @@ -513,7 +513,10 @@ _wrap_test_value_array(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &obj)) return NULL; + G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_value_init(value, G_TYPE_VALUE_ARRAY); + G_GNUC_END_IGNORE_DEPRECATIONS + if (pyg_value_from_pyobject(value, obj)) { PyErr_SetString(PyExc_TypeError, "Could not convert to GValueArray"); return NULL; |