+commit 902bb6685fd9c90c7d81127861a152b0fab4b107
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Tue Apr 30 11:49:03 2013 -0700
+
+ release 3.9.1
+
+ NEWS | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 49 insertions(+)
+
+commit f463d7cfaf65e0f3594ec15d897325f84225f1c5
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sun Apr 28 19:59:35 2013 -0700
+
+ gtk-demo: Wrap description strings at 80 characters
+
+ Wrap trailing demo description strings so they are easier to read
+ in a programming editor. The gtk-demo itself re-wraps this using
+ textwrap and the Gtk.TextView dynamic wrapping.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698547
+
+ demos/gtk-demo/demos/Entry/search_entry.py | 6 +++---
+ demos/gtk-demo/demos/Icon View/iconviewbasics.py | 8 ++++----
+ demos/gtk-demo/demos/Icon View/iconviewedit.py | 5 +++--
+ demos/gtk-demo/demos/Tree View/liststore.py | 5 ++++-
+ demos/gtk-demo/demos/images.py | 6 ++++--
+ demos/gtk-demo/demos/menus.py | 20
+ ++++++++++++++++----
+ demos/gtk-demo/demos/pickers.py | 4 ++--
+ demos/gtk-demo/demos/pixbuf.py | 5 +++--
+ demos/gtk-demo/demos/rotatedtext.py | 6 ++++--
+ 9 files changed, 43 insertions(+), 22 deletions(-)
+
+commit f0d4b963c42ac31d4d17ec0f2271940df2568644
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sat Apr 27 22:30:35 2013 -0700
+
+ gtk-demo: Use textwrap to reformat description for Gtk.TextView
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698547
+
+ demos/gtk-demo/gtk-demo.py | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+commit ed41e260dcf5745fcc0656412be3c4a520ee20fc
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sat Apr 27 21:58:28 2013 -0700
+
+ gtk-demo: Use GtkSource.View for showing source code
+
+ Replace manual syntax highlighting of Gtk.TextView with usage of
+ GtkSource.View when available. Fall back to TextView with no
+ hightlighting when GtkSource is not available.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698547
+
+ demos/gtk-demo/gtk-demo.py | 170
+ ++++++++++++---------------------------------
+ 1 file changed, 44 insertions(+), 126 deletions(-)
+
+commit 150104db47ac5ba32758fba0c156adaecc0fbcc0
+Author: Mike Ruprecht <mike.ruprecht@collabora.co.uk>
+Date: Sun Apr 28 01:40:34 2013 -0500
+
+ Use correct class for GtkEditable's get_selection_bounds() function
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=699096
+
+ gi/overrides/Gtk.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 61663928259f6f48c11f6e43334a62dd2b3eb8e6
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Apr 25 05:27:35 2013 -0700
+
+ Test results of g_base_info_get_name for NULL
+
+ Block against potential NULL result when generating type hint with
+ _g_arg_get_pytype_hint.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698829
+
+ gi/pygi-info.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+commit 0dff1940caf52ea5f1de27cc801ea6d4dab3a446
+Author: Jose Rostagno <joserostagno@vijona.com.ar>
+Date: Sun Apr 21 19:09:59 2013 -0300
+
+ Remove g_type_init conditional call
+
+ It's deprecated in the glib version we depend on.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698763
+
+ gi/_gobject/gobjectmodule.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+commit c84b071ed8d3b78b4e4a6aef12f5f8bb99bdc107
+Author: Jose Rostagno <joserostagno@vijona.com.ar>
+Date: Sat Mar 30 20:59:44 2013 -0300
+
+ Update deps versions also in README
+
+ commit f957e33bc1ef2a4175bab85cfcd9b5faf092aa2f missed to update
+ that file
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698763
+
+ README | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 4f25fa43e1e5c0f3cd22bcdadadb1d731f01fe34
+Author: Jose Rostagno <joserostagno@vijona.com.ar>
+Date: Sat Mar 30 20:50:35 2013 -0300
+
+ Drop compat code for old python version
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698763
+
+ gi/_glib/pyglib-python-compat.h | 12 ------------
+ 1 file changed, 12 deletions(-)
+
+commit 8104fa04cac2cba74337e6c4b3ecf56fd6cbb80b
+Author: Niklas Koep <niklas.koep@gmail.com>
+Date: Thu Apr 25 06:14:12 2013 +0200
+
+ Remove duplicate call to _gi.Repository.require()
+
+ repository.require() was called twice in IntrospectionModule's
+ constructor.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698797
+
+ gi/module.py | 1 -
+ 1 file changed, 1 deletion(-)
+
+commit f22b95033c0bcd99e9c70e6f0dc999f5e64b08a6
+Author: Johan Dahlin <johan@gnome.org>
+Date: Mon Oct 1 03:02:10 2012 -0700
+
+ Add ObjectInfo.get_class_struct()
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=685218
+
+ gi/pygi-info.c | 15 +++++++++++++++
+ tests/test_gi.py | 4 ++++
+ 2 files changed, 19 insertions(+)
+
+commit 2d34d35e5db06b0eb29cba91d0999b20a5c0b450
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Mon Apr 22 03:43:23 2013 -0700
+
+ Change interpretation of NULL pointer field from None to 0
+
+ The usage of 0 is needed because these fields should generally
+ be used to store integer indices or hashes, not necessarily
+ pointers to actual data.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698366
+
+ gi/pygi-argument.c | 11 +----------
+ tests/test_everything.py | 5 +++--
+ 2 files changed, 4 insertions(+), 12 deletions(-)
+
+commit 8d61ad38eb90d639da08289c036ae4cb99336c2a
+Author: Sobhan Mohammadpour <sobhanmohammadpour1@yahoo.fr>
+Date: Fri Mar 8 08:25:58 2013 +0330
+
+ Do not build tests until needed
+
+ Originally by [Alexandre Rostovtsev <tetromino@gmail.com>
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698444
+
+ tests/Makefile.am | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+commit f61f23b999ae6e27ca852753da906de4ab8e6e25
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date: Sun Apr 14 15:16:40 2013 +1000
+
+ pygi-convert: Support toolbar styles
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 7a92ade7ee5fe2f9eb8de2626c34650e2e5c06df
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date: Sun Apr 14 10:54:04 2013 +1000
+
+ pygi-convert: Support new-style constructors for Gio.File
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit 1e8120992dc103ac817351be3c150e6cb25f719f
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date: Sun Apr 14 10:22:55 2013 +1000
+
+ pygi-convert: Add some support for recent manager constructs
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 17d349f98d62ea7947c1553e0ef7e867301523aa
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date: Sun Apr 14 07:37:24 2013 +1000
+
+ pygi-convert: Check for double quote in require statement
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit cc8bd6bd3fdf99762aa3431ceee347a05f6f3200
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date: Sun Apr 14 07:37:00 2013 +1000
+
+ pygi-convert: Don't transform arbitrary keysym imports
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 99872a18ed1468b2c85cc7b96a0d12f2ae5167f0
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Apr 11 04:09:59 2013 -0700
+
+ Remove Python keyword escapement in Repository.find_by_name
+
+ Strip trailing underscore from module level items before
+ calling g_irepository_find_by_name. This fixes a problem
+ with GI module level items having the same name as a Python
+ keyword raising an AttributeError during access (Pango.break_).
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=697363
+
+ gi/pygi-info.c | 32 ++++++++++++++++++++++----------
+ gi/pygi-info.h | 2 ++
+ gi/pygi-repository.c | 16 ++++++++++++++++
+ tests/test_overrides_pango.py | 5 +++++
+ 4 files changed, 45 insertions(+), 10 deletions(-)
+
+commit c07404461b126206e369270b56e613f81369c70a
+Author: Daniel Drake <dsd@laptop.org>
+Date: Mon Mar 18 16:08:09 2013 -0600
+
+ Optimize signal lookup in gi repository
+
+ Now that we have GSignalQuery results available to us when connecting
+ signals, we already know which GType implements the signal in
+ question.
+
+ Therefore there is no need to traverse the class parent hierarchy
+ looking for this, which takes a considerable amount of CPU time.
+
+ There is also no need to canonicalize the signal name; both before
+ and after this patch, by the time we reach this point we have already
+ successfully looked up the signal name as presented from Python.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/pygobject.c | 5 ++--
+ gi/pygi-signal-closure.c | 59
+ +++++++++++++-----------------------------------
+ gi/pygi-signal-closure.h | 1 +
+ gi/pygi.h | 4 +++-
+ 4 files changed, 23 insertions(+), 46 deletions(-)
+
+commit e220706b3e4d9fd454613fbfe1e60e7e1da94ae0
+Author: Daniel Drake <dsd@laptop.org>
+Date: Mon Mar 18 15:38:19 2013 -0600
+
+ Optimize connection of Python-implemented signals
+
+ Like properties, when working with signals we must detect if the
+ signal is implemented in a Python class or if it originates from the
+ gi repository, and act accordingly.
+
+ Asking the gi repository if it can find a signal that is implemented
+ in a Python class (it can't) takes a considerable amount of CPU time.
+
+ Use g_signal_query() to find out which GType implements the signal.
+ Then perform a simple test to see if this type is implemented at the
+ Python level, allowing us to to skip the GI querying in this case.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/pygobject.c | 19 +++++++++++++++----
+ 1 file changed, 15 insertions(+), 4 deletions(-)
+
+commit e91b35d72f93678a79623347dce271148d57046f
+Author: Daniel Drake <dsd@laptop.org>
+Date: Mon Mar 18 15:24:52 2013 -0600
+
+ Consolidate signal connection code
+
+ This code was repeated 4 times with very little variance;
+ consolidate it and add simple tests to ensure basic coverage.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/pygobject.c | 129
+ +++++++++++++++--------------------------------
+ tests/test_everything.py | 33 ++++++++++++
+ 2 files changed, 74 insertions(+), 88 deletions(-)
+
+commit cd91e1d5db617d470acbf8c5bc74c11c92f946f6
+Author: Daniel Drake <dsd@laptop.org>
+Date: Mon Mar 18 15:11:16 2013 -0600
+
+ Fix setting of struct property values
+
+ "goto out" in this context means that an error occurred, but this
+ particular instance was sitting in the "good" codepath.
+
+ Fixes setting of struct property values.
+
+ gi/pygi-property.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit 8981ea0422c6837d488311dafe8937593372e736
+Author: Daniel Drake <dsd@laptop.org>
+Date: Mon Mar 18 14:25:45 2013 -0600
+
+ Optimize property get/set when using GObject.props
+
+ Skip GI repository lookup for properties defined on Python
+ defined GObject types.
+
+ Signed-off-by: Simon Feltman <sfeltman@src.gnome.org>
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/pygobject.c | 37 +++++++++++++++++++------------------
+ 1 file changed, 19 insertions(+), 18 deletions(-)
+
+commit 266e389ff90d982151bae3ac22b9b8b0739f520f
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Sat Apr 13 17:28:26 2013 +0200
+
+ configure.ac: Fix PYTHON_SO with Python3.3
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696646
+
+ configure.ac | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+commit e54c2d1df3812a1789ee240b0ba71ddf77c2f90a
+Author: Daniel Drake <dsd@laptop.org>
+Date: Mon Mar 18 14:13:37 2013 -0600
+
+ Simplify registration of custom types
+
+ Use custom quark data to track Python created GTypes.
+
+ Remove previous mechanism to track registration of python-implemented
+ GTypes as it was unused (no custom registration was ever tracked).
+
+ Leave vtable pointer and set to NULL to avoid an ABI break.
+
+ Signed-off-by: Simon Feltman <sfeltman@src.gnome.org>
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/gobjectmodule.c | 11 +++++--
+ gi/_gobject/pygobject-private.h | 8 ++---
+ gi/_gobject/pygobject.c | 8 ++---
+ gi/_gobject/pygobject.h | 9 +++---
+ gi/_gobject/pygtype.c | 69
+ +++--------------------------------------
+ 5 files changed, 22 insertions(+), 83 deletions(-)
+
+commit 50702a09344825e3a8aa54365d78de807f989d88
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Sat Apr 13 16:04:17 2013 +0200
+
+ pygi-convert.sh: Add GStreamer rules
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=697951
+
+ pygi-convert.sh | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+commit b289176e6b37cb2825bd555cea019b85b68d5c57
+Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Sun Mar 10 15:04:40 2013 +0200
+
+ pygi-convert: Add rule for TreeModelFlags
+
+ Signed-off-by: Simon Feltman <sfeltman@src.gnome.org>
+
+ pygi-convert.sh | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 09610bf42be76f65d7d2afe1c691f7b4a7c64e5b
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Fri Mar 29 03:20:44 2013 -0700
+
+ Unify interface struct to Python GI marshaling code
+
+ Add pygi_marshal_to_py_interface_struct used for direct gi method
+ call out args and vfunc in args.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 72 ++++++-------------------------
+ gi/pygi-marshal-to-py.c | 112
+ +++++++++++++++++++++++++++++-------------------
+ gi/pygi-marshal-to-py.h | 8 ++++
+ 3 files changed, 91 insertions(+), 101 deletions(-)
+
+commit 6d3a0751e71ee3c37b3bb646723aed75971e5b39
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Mar 28 22:41:51 2013 -0700
+
+ Unify Python interface struct to GI marshaling code
+
+ Add pygi_marshal_from_py_interface_struct used for direct gi method
+ call in args and vfunc out args.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 75 +++++++--------------
+ gi/pygi-cache.c | 12 +---
+ gi/pygi-marshal-from-py.c | 167
+ +++++++++++++++++++++++++++++-----------------
+ gi/pygi-marshal-from-py.h | 11 +++
+ 4 files changed, 141 insertions(+), 124 deletions(-)
+
+commit 1ea654b4d34e0d119556b232796cd9370b2572f1
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Mar 28 06:17:15 2013 -0700
+
+ Unify Python float and double to GI marshaling code
+
+ Change _pygi_argument_from_object to use the cachers marshalers
+ (_pygi_marshal_from_py_float/double) directly instead of keeping a
+ copy of the code.
+ Refactor _pygi_marshal_from_py_float/double to use a common utility
+ _pygi_py_arg_to_double for initial error checking and conversion.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 26 ++++----------------------
+ gi/pygi-marshal-from-py.c | 42 ++++++++++++++++++++----------------------
+ 2 files changed, 24 insertions(+), 44 deletions(-)
+
+commit 2eb2a712864a1a685d19018e0860cf0da7c5c9ab
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Mar 28 05:29:08 2013 -0700
+
+ Unify filename to Python GI marshaling code
+
+ Change _pygi_argument_to_object to use the cachers marshaler
+ (_pygi_marshal_to_py_filename) directly instead of keeping a
+ copy of the code.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 22 ++--------------------
+ gi/pygi-marshal-to-py.c | 6 ++----
+ 2 files changed, 4 insertions(+), 24 deletions(-)
+
+commit 54aa043d96deb02589e13042a46917405ca53780
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Mar 28 05:20:00 2013 -0700
+
+ Unify utf8 to Python GI marshaling code
+
+ Change _pygi_argument_to_object to use the cachers marshaler
+ (_pygi_marshal_to_py_utf8) directly instead of keeping a
+ copy of the code.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 11 ++++-------
+ gi/pygi-marshal-to-py.c | 4 +---
+ 2 files changed, 5 insertions(+), 10 deletions(-)
+
+commit 03ff41ae4bb83858338d96cc6210092c7fb82464
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Mar 28 05:10:45 2013 -0700
+
+ Unify unichar to Python GI marshaling code
+
+ Change _pygi_argument_to_object to use the cachers marshaler
+ (_pygi_marshal_to_py_unichar) directly instead of keeping a
+ copy of the code.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 19 ++-----------------
+ 1 file changed, 2 insertions(+), 17 deletions(-)
+
+commit 594ad084c2cc21cebce209c11740e6d4866b0b82
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sat Feb 16 19:49:59 2013 -0800
+
+ Unify Python unicode to filename GI marshaling code
+
+ Change _pygi_argument_from_object to use the cachers marshaler
+ (_pygi_marshal_from_py_filename) directly instead of keeping a
+ copy of the code.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 30 ++----------------------------
+ 1 file changed, 2 insertions(+), 28 deletions(-)
+
+commit a62e8cdf90f7b03cfc8116125ef3557f9ad08dde
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sat Feb 16 19:32:54 2013 -0800
+
+ Unify Python unicode to utf8 GI marshaling code
+
+ Change _pygi_argument_from_object to use the cachers marshaler
+ (_pygi_marshal_from_py_utf8) directly instead of keeping a
+ copy of the code.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 32 ++------------------------------
+ 1 file changed, 2 insertions(+), 30 deletions(-)
+
+commit e253c73335fccabc61e0329f8528a90f79858c67
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sat Feb 16 19:16:43 2013 -0800
+
+ Unify Python unicode to unichar GI marshaling code
+
+ Change _pygi_argument_from_object to use the cachers marshaler
+ (_pygi_marshal_from_py_unichar) directly instead of keeping a
+ copy of the code.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 34 ++--------------------------------
+ gi/pygi-marshal-from-py.c | 9 +++++++++
+ 2 files changed, 11 insertions(+), 32 deletions(-)
+
+commit 216caf590b262fed40d10bb34d020089d1197160
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Apr 4 15:57:12 2013 -0700
+
+ Fix enum and flags marshaling type assumptions
+
+ Replace assignments of GFlags and GEnum values to various GIArgument
+ members with v_uint and v_int respectively.
+
+ gi/pygi-argument.c | 6 +++---
+ gi/pygi-property.c | 4 ++--
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+commit 4799ef1d0cb9a4b27c7952585d33b58ea9ec34ca
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Thu Apr 4 10:08:38 2013 +0200
+
+ Make AM_CHECK_PYTHON_LIBS not depend on AM_CHECK_PYTHON_HEADERS
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696648#c6
+
+ m4/python.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit f82f755a0f419539c223e4a74e33145726c6e69f
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Thu Apr 4 09:05:48 2013 +0200
+
+ Use distutils.sysconfig to retrieve the python include path.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696648
+
+ m4/python.m4 | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+commit cf81dd66e6387bf27122a71176e91ca39beb6519
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Thu Apr 4 06:47:56 2013 +0200
+
+ Use g_strdup() consistently
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696650
+
+ gi/pygi-marshal-from-py.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 6c22fea63fa6978c2a717ff12ff84d3aff776b5e
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Tue Mar 26 16:03:59 2013 +0100
+
+ Support PEP 3149 (ABI version tagged .so files)
+
+ Add a ABI suffix to the shared library retrieved from
+ distutils.sysconfig
+ instead of hardcoding it. This should also make things more robust
+ on Windows.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696646
+
+ configure.ac | 3 +++
+ gi/Makefile.am | 14 +++++++-------
+ gi/_glib/Makefile.am | 14 +++++++-------
+ gi/_gobject/Makefile.am | 14 +++++++-------
+ 4 files changed, 24 insertions(+), 21 deletions(-)
+
+commit 2259ccac8aa2ec23240e92e303ea3f2c53dc2a88
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sun Mar 31 01:32:34 2013 -0700
+
+ Fix stack corruption due to incorrect format for argument parser
+
+ Fix call to PyArg_ParseTupleAndKeywords that used a format parser
+ of "l" meaning long (8 bytes) in combination with an output pointer
+ of guint (4 bytes). Change to use gulong with a format of "k".
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=696892
+
+ gi/_gobject/pygflags.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 48e52210ece0e144b4c959e773ea542a912358e7
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Mar 7 00:26:37 2013 -0800
+
+ Deprecate GLib and GObject threads_init
+
+ Remove a handful of Python threading related helper functions
+ from pyglib and pygobject. The binding internals required
+ GLib.threads_init to be called for PyGObject to work with
+ Python threads. This was removed as it should not be a requirement.
+ Using the Python threading module already initializes threading
+ for us (PyEval_InitThreads).
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=686914
+
+ gi/_glib/glibmodule.c | 16 --------
+ gi/_glib/pyglib.c | 94
+ ---------------------------------------------
+ gi/_glib/pyglib.h | 28 +++++++-------
+ gi/_gobject/gobjectmodule.c | 31 ++++-----------
+ gi/overrides/GLib.py | 8 +++-
+ gi/overrides/GObject.py | 2 +-
+ 6 files changed, 28 insertions(+), 151 deletions(-)
+
+commit 89d05f91cee419d46cb5318d4a9001ec315a3475
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Mar 25 09:03:51 2013 +0100
+
+ Drop support for Python 2.6
+
+ 2.7 has been released long ago, nobody tests PyGObject with 2.6 any
+ more, and
+ this unblocks e. g. GNOME #682320.
+
+ Drop usage of PyCObject_* (which has been superseded by PyCapsule
+ for >= 2.7),
+ and drop Python 2.6 specific workarounds.
+
+ configure.ac | 2 +-
+ gi/_glib/pyglib-python-compat.h | 20 ------------------
+ gi/_gobject/pygobject.h | 6 ------
+ gi/pygi.h | 4 ----
+ m4/python.m4 | 2 +-
+ tests/runtests.py | 45
+ +----------------------------------------
+ tests/test_gobject.py | 1 -
+ tests/test_signal.py | 4 ----
+ 8 files changed, 3 insertions(+), 81 deletions(-)
+
+commit 56347953abb1e214817186581eaf2b2d8762cf97
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Wed Oct 24 16:43:25 2012 +0200
+
+ Remove static PollFD bindings
+
+ Use the GLib API through GI instead, and provide an override to keep a
+ backwards compatible constructor syntax.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=686795
+
+ gi/_glib/Makefile.am | 2 --
+ gi/_glib/glibmodule.c | 2 --
+ gi/_glib/pygsource.c | 98
+ ---------------------------------------------------
+ gi/_glib/pygsource.h | 36 -------------------
+ gi/overrides/GLib.py | 17 +++++++--
+ 5 files changed, 15 insertions(+), 140 deletions(-)
+
+commit a93eb5ecc982b5fe1bdf8f78b15ba10351a63b89
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Mar 25 08:44:24 2013 +0100
+
+ Drop test skipping due to too old g-i
+
+ We depend on gobject-introspection 1.35.9 now, which has all this API.
+
+ tests/test_gi.py | 24 ------------------------
+ tests/test_object_marshaling.py | 14 --------------
+ 2 files changed, 38 deletions(-)
+
+commit f957e33bc1ef2a4175bab85cfcd9b5faf092aa2f
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Mar 25 08:37:37 2013 +0100
+
+ Bump glib and g-i dependencies
+
+ Now require g-i 1.35.9 and glib 2.35.9, i. e. the current stable
+ GNOME 3.8
+ versions. This allows us to drop the conditional test suite skips
+ and drop the
+ static PollFD bindings.
+
+ configure.ac | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+commit 252556d044322207429c0d0c269365f48e4d819a
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Mar 25 08:43:53 2013 +0100
+
+ configure.ac: post-release version bump to 3.9.1
+
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
commit 5f82e007e2dcdbfd82a20d8c4d54f9cd7b3b77ac
Author: Martin Pitt <martinpitt@gnome.org>
Date: Mon Mar 25 08:12:10 2013 +0100
PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
+3.9.1 30-Apr-2013
+ - gtk-demo: Wrap description strings at 80 characters (Simon Feltman)
+ (#698547)
+ - gtk-demo: Use textwrap to reformat description for Gtk.TextView
+ (Simon Feltman) (#698547)
+ - gtk-demo: Use GtkSource.View for showing source code (Simon Feltman)
+ (#698547)
+ - Use correct class for GtkEditable's get_selection_bounds() function
+ (Mike Ruprecht) (#699096)
+ - Test results of g_base_info_get_name for NULL (Simon Feltman)
+ (#698829)
+ - Add ObjectInfo.get_class_struct() (Johan Dahlin) (#685218)
+ - Change interpretation of NULL pointer field from None to 0
+ (Simon Feltman) (#698366)
+ - Do not build tests until needed (Sobhan Mohammadpour) (#698444)
+ - pygi-convert: Support toolbar styles (Kai Willadsen) (#698477)
+ - pygi-convert: Support new-style constructors for Gio.File
+ (Kai Willadsen) (#698477)
+ - pygi-convert: Add some support for recent manager constructs
+ (Kai Willadsen) (#698477)
+ - pygi-convert: Don't transform arbitrary keysym imports
+ (Kai Willadsen) (#698477)
+ - Remove Python keyword escapement in Repository.find_by_name
+ (Simon Feltman) (#697363)
+ - Optimize signal lookup in gi repository (Daniel Drake) (#696143)
+ - Optimize connection of Python-implemented signals (Daniel Drake)
+ (#696143)
+ - Consolidate signal connection code (Daniel Drake) (#696143)
+ - Fix setting of struct property values (Daniel Drake)
+ - Optimize property get/set when using GObject.props (Daniel Drake)
+ (#696143)
+ - configure.ac: Fix PYTHON_SO with Python3.3 (Christoph Reiter)
+ (#696646)
+ - Simplify registration of custom types (Daniel Drake) (#696143)
+ - pygi-convert.sh: Add GStreamer rules (Christoph Reiter) (#697951)
+ - pygi-convert: Add rule for TreeModelFlags (Jussi Kukkonen)
+ - Unify GI marshalling code (Simon Feltman) (#693405)
+ - Use distutils.sysconfig to retrieve the python include path.
+ (Christoph Reiter) (#696648)
+ - Support PEP 3149 (ABI version tagged .so files) (Christoph Reiter)
+ (#696646)
+ - Fix stack corruption due to incorrect format for argument parser
+ (Simon Feltman) (#696892)
+ - Deprecate GLib and GObject threads_init (Simon Feltman) (#686914)
+ - Drop support for Python 2.6 (Martin Pitt)
+ - Remove static PollFD bindings (Martin Pitt) (#686795)
+ - Drop test skipping due to too old g-i (Martin Pitt)
+ - Bump glib and g-i dependencies (Martin Pitt)
+
3.8.0 25-Mar-2013
- tests: Fix incorrect assumption when testing pyglib version
(Simon Feltman)
Metadata-Version: 1.0
Name: PyGObject
-Version: 3.8.0
+Version: 3.9.1
Summary: Python bindings for GObject
Home-page: http://www.pygtk.org/
Author: James Henstridge
Maintainer: Johan Dahlin
Maintainer-email: johan@gnome.org
License: GNU LGPL
-Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.8/pygobject-3.8.0.tar.gz
+Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.gz
Description: Python bindings for GLib and GObject
Platform: POSIX, Windows
Classifier: Development Status :: 5 - Production/Stable
Requirements
============
* C compiler (GCC and MSVC supported)
- * Python 2.6 or higher
- * Glib/Gio 2.34.2 or higher
+ * Python 2.7 or higher
+ * Glib/Gio 2.35.9 or higher
* libffi (optional)
Copyright Information
])
# List of supported lcov versions.
- lcov_version_list="1.6 1.7 1.8 1.9"
+ lcov_version_list="1.6 1.7 1.8 1.9 1.10"
AC_CHECK_PROG([LCOV], [lcov], [lcov])
AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pygobject 3.8.0.
+# Generated by GNU Autoconf 2.69 for pygobject 3.9.1.
#
# Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
#
# Identity of this package.
PACKAGE_NAME='pygobject'
PACKAGE_TARNAME='pygobject'
-PACKAGE_VERSION='3.8.0'
-PACKAGE_STRING='pygobject 3.8.0'
+PACKAGE_VERSION='3.9.1'
+PACKAGE_STRING='pygobject 3.9.1'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
PACKAGE_URL='https://live.gnome.org/PyGObject/'
PYTHON_LIB_LOC
PYTHON_LIBS
PYTHON_INCLUDES
+PYTHON_SO
pkgpyexecdir
pyexecdir
pkgpythondir
# 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.8.0 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.9.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of pygobject 3.8.0:";;
+ short | recursive ) echo "Configuration of pygobject 3.9.1:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pygobject configure 3.8.0
+pygobject configure 3.9.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
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.8.0, which was
+It was created by pygobject $as_me 3.9.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
PYGOBJECT_MAJOR_VERSION=3
-$as_echo "#define PYGOBJECT_MINOR_VERSION 8" >>confdefs.h
+$as_echo "#define PYGOBJECT_MINOR_VERSION 9" >>confdefs.h
-PYGOBJECT_MINOR_VERSION=8
+PYGOBJECT_MINOR_VERSION=9
-$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"
# Define the identity of the package.
PACKAGE='pygobject'
- VERSION='3.8.0'
+ VERSION='3.9.1'
cat >>confdefs.h <<_ACEOF
if test -n "$PYTHON"; then
# If the user set $PYTHON, use it and don't search something else.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version >= 2.6" >&5
-$as_echo_n "checking whether $PYTHON version >= 2.6... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version >= 2.7" >&5
+$as_echo_n "checking whether $PYTHON version >= 2.7... " >&6; }
prog="import sys
# split strings by '.' and convert to numeric. Append some zeros
# because we need at least 4 digits for the hex conversion.
# map returns an iterator in Python 3.0 and a list in 2.x
-minver = list(map(int, '2.6'.split('.'))) + [0, 0, 0]
+minver = list(map(int, '2.7'.split('.'))) + [0, 0, 0]
minverhex = 0
# xrange is not present in Python 3.0 and range returns an iterator
for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
else
# Otherwise, try each interpreter until we find one that satisfies
# VERSION.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.6" >&5
-$as_echo_n "checking for a Python interpreter with version >= 2.6... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.7" >&5
+$as_echo_n "checking for a Python interpreter with version >= 2.7... " >&6; }
if ${am_cv_pathless_PYTHON+:} false; then :
$as_echo_n "(cached) " >&6
else
- for am_cv_pathless_PYTHON in python3 python3.3 python3.2 python3.1 python2 python2.7 python2.6 python none; do
+ for am_cv_pathless_PYTHON in python3 python3.3 python3.2 python3.1 python2 python2.7 python none; do
test "$am_cv_pathless_PYTHON" = none && break
prog="import sys
# split strings by '.' and convert to numeric. Append some zeros
# because we need at least 4 digits for the hex conversion.
# map returns an iterator in Python 3.0 and a list in 2.x
-minver = list(map(int, '2.6'.split('.'))) + [0, 0, 0]
+minver = list(map(int, '2.7'.split('.'))) + [0, 0, 0]
minverhex = 0
# xrange is not present in Python 3.0 and range returns an iterator
for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
fi
fi
+# - 'SO' for PyPy, CPython 2.7-3.2
+# - 'EXT_SUFFIX' for CPython3.3+ (http://bugs.python.org/issue16754)
+# - fallback to '.so'
+PYTHON_SO=`$PYTHON -c "import distutils.sysconfig, sys; get = distutils.sysconfig.get_config_var; sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"`
+
+
# Find any Python interpreter.
if test -z "$PYTHON"; then
- for ac_prog in python3 python3.3 python3.2 python3.1 python2 python2.7 python2.6 python
+ for ac_prog in python3 python3.3 python3.2 python3.1 python2 python2.7 python
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
if test -x "$PYTHON_CONFIG"; then
PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null`
else
- 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_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
- if test "$py_prefix" != "$py_exec_prefix"; then
- PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
- fi
+ PYTHON_INCLUDES=`$PYTHON -c "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc(True))"`
+ PYTHON_INCLUDES="-I$PYTHON_INCLUDES"
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libraries required to embed python" >&5
$as_echo_n "checking for libraries required to embed python... " >&6; }
-py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
+py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
if test "x$PYTHON_LIBS" = x; then
PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}"
fi
PKG_CONFIG=no
fi
- min_glib_version=2.34.2
+ min_glib_version=2.35.9
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB - version >= $min_glib_version" >&5
$as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; }
pkg_cv_GIO_CFLAGS="$GIO_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.34.2\""; } >&5
- ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.34.2") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.35.9\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.35.9") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_GIO_CFLAGS=`$PKG_CONFIG --cflags "gio-2.0 >= 2.34.2" 2>/dev/null`
+ pkg_cv_GIO_CFLAGS=`$PKG_CONFIG --cflags "gio-2.0 >= 2.35.9" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
pkg_cv_GIO_LIBS="$GIO_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.34.2\""; } >&5
- ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.34.2") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.35.9\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.35.9") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_GIO_LIBS=`$PKG_CONFIG --libs "gio-2.0 >= 2.34.2" 2>/dev/null`
+ pkg_cv_GIO_LIBS=`$PKG_CONFIG --libs "gio-2.0 >= 2.35.9" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- GIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gio-2.0 >= 2.34.2" 2>&1`
+ GIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gio-2.0 >= 2.35.9" 2>&1`
else
- GIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gio-2.0 >= 2.34.2" 2>&1`
+ GIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gio-2.0 >= 2.35.9" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$GIO_PKG_ERRORS" >&5
- as_fn_error $? "Package requirements (gio-2.0 >= 2.34.2) were not met:
+ as_fn_error $? "Package requirements (gio-2.0 >= 2.35.9) were not met:
$GIO_PKG_ERRORS
pkg_cv_GI_CFLAGS="$GI_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.34.2
- gobject-introspection-1.0 >= 1.34.2
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.35.9
+ gobject-introspection-1.0 >= 1.35.9
\""; } >&5
- ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.34.2
- gobject-introspection-1.0 >= 1.34.2
+ ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.35.9
+ gobject-introspection-1.0 >= 1.35.9
") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_GI_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.34.2
- gobject-introspection-1.0 >= 1.34.2
+ pkg_cv_GI_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.35.9
+ gobject-introspection-1.0 >= 1.35.9
" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_cv_GI_LIBS="$GI_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.34.2
- gobject-introspection-1.0 >= 1.34.2
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.35.9
+ gobject-introspection-1.0 >= 1.35.9
\""; } >&5
- ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.34.2
- gobject-introspection-1.0 >= 1.34.2
+ ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.35.9
+ gobject-introspection-1.0 >= 1.35.9
") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_GI_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.34.2
- gobject-introspection-1.0 >= 1.34.2
+ pkg_cv_GI_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.35.9
+ gobject-introspection-1.0 >= 1.35.9
" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- GI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.34.2
- gobject-introspection-1.0 >= 1.34.2
+ GI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.35.9
+ gobject-introspection-1.0 >= 1.35.9
" 2>&1`
else
- GI_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.34.2
- gobject-introspection-1.0 >= 1.34.2
+ GI_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.35.9
+ gobject-introspection-1.0 >= 1.35.9
" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$GI_PKG_ERRORS" >&5
- as_fn_error $? "Package requirements (glib-2.0 >= 2.34.2
- gobject-introspection-1.0 >= 1.34.2
+ as_fn_error $? "Package requirements (glib-2.0 >= 2.35.9
+ gobject-introspection-1.0 >= 1.35.9
) were not met:
$GI_PKG_ERRORS
fi
# List of supported lcov versions.
- lcov_version_list="1.6 1.7 1.8 1.9"
+ lcov_version_list="1.6 1.7 1.8 1.9 1.10"
# Extract the first word of "lcov", so it can be a program name with args.
set dummy lcov; ac_word=$2
# 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.8.0, which was
+This file was extended by pygobject $as_me 3.9.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
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.8.0
+pygobject config.status 3.9.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
# You can also build against a full interpreter path, such as
# $ ./configure --with-python=~/my-patched-python/python
-m4_define(python_min_ver, 2.6)
+m4_define(python_min_ver, 2.7)
m4_define(python3_min_ver, 3.1)
dnl the pygobject version number
m4_define(pygobject_major_version, 3)
-m4_define(pygobject_minor_version, 8)
-m4_define(pygobject_micro_version, 0)
+m4_define(pygobject_minor_version, 9)
+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 ...
-m4_define(introspection_required_version, 1.34.2)
+m4_define(introspection_required_version, 1.35.9)
m4_define(py2cairo_required_version, 1.2.0)
m4_define(py3cairo_required_version, 1.10.0)
-m4_define(glib_required_version, 2.34.2)
-m4_define(gio_required_version, 2.34.2)
+m4_define(glib_required_version, 2.35.9)
+m4_define(gio_required_version, 2.35.9)
AC_INIT([pygobject],[pygobject_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject],
[AC_MSG_ERROR(too old)])
fi
+# - 'SO' for PyPy, CPython 2.7-3.2
+# - 'EXT_SUFFIX' for CPython3.3+ (http://bugs.python.org/issue16754)
+# - fallback to '.so'
+PYTHON_SO=`$PYTHON -c "import distutils.sysconfig, sys; get = distutils.sysconfig.get_config_var; sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"`
+AC_SUBST(PYTHON_SO)
+
AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found]))
if test "x$os_win32" = "xyes"; then
AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.]))
PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
extension_ldflags = \
-module \
- -avoid-version
+ -avoid-version \
+ -shrext $(PYTHON_SO)
if OS_WIN32
# Windows requires Python modules to be explicitly linked to libpython.
$(PYTHON_LIBS)
extension_ldflags += \
- -no-undefined \
- -shrext ".pyd"
+ -no-undefined
endif
pygidir = $(pyexecdir)/gi
# This is to ensure we have a symlink to the .so in the
# build directory, which the Python interpreter can load
# directly without having to know how to parse .la files.
-.la.so:
+%$(PYTHON_SO): %.la
$(LN_S) -f .libs/$@ $@
# if we build in a separate tree, we need to symlink the *.py files from the
[ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
done
-all-local: $(LTLIBRARIES:.la=.so) build_pylinks
+all-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
-check-local: $(LTLIBRARIES:.la=.so) build_pylinks
+check-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
clean-local:
- rm -f $(LTLIBRARIES:.la=.so)
+ rm -f $(LTLIBRARIES:.la=$(PYTHON_SO))
build_triplet = @build@
host_triplet = @host@
@OS_WIN32_TRUE@am__append_1 = \
-@OS_WIN32_TRUE@ -no-undefined \
-@OS_WIN32_TRUE@ -shrext ".pyd"
+@OS_WIN32_TRUE@ -no-undefined
@ENABLE_CAIRO_TRUE@am__append_2 = _gi_cairo.la
subdir = gi
PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
$(PYTHON_INCLUDES) \
-DPY_SSIZE_T_CLEAN
-extension_ldflags = -module -avoid-version $(am__append_1)
+extension_ldflags = -module -avoid-version -shrext $(PYTHON_SO) \
+ $(am__append_1)
# Windows requires Python modules to be explicitly linked to libpython.
# Extension modules are shared libaries (.dll), but need to be
all: all-recursive
.SUFFIXES:
-.SUFFIXES: .c .la .lo .o .obj .so
+.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
# This is to ensure we have a symlink to the .so in the
# build directory, which the Python interpreter can load
# directly without having to know how to parse .la files.
-.la.so:
+%$(PYTHON_SO): %.la
$(LN_S) -f .libs/$@ $@
# if we build in a separate tree, we need to symlink the *.py files from the
[ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
done
-all-local: $(LTLIBRARIES:.la=.so) build_pylinks
+all-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
-check-local: $(LTLIBRARIES:.la=.so) build_pylinks
+check-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
clean-local:
- rm -f $(LTLIBRARIES:.la=.so)
+ rm -f $(LTLIBRARIES:.la=$(PYTHON_SO))
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
extension_ldflags = \
-module \
- -avoid-version
+ -avoid-version \
+ -shrext $(PYTHON_SO)
if OS_WIN32
# Windows requires Python modules to be explicitly linked to libpython.
$(PYTHON_LIBS)
extension_ldflags += \
- -no-undefined \
- -shrext ".pyd"
+ -no-undefined
endif
pygoptioncontext.h \
pygoptiongroup.c \
pygoptiongroup.h \
- pygsource.c \
- pygsource.h \
pygspawn.c \
pygspawn.h
_glib_la_CFLAGS = \
done
-all: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
clean-local:
- rm -f $(pyglib_LTLIBRARIES:.la=.so)
-.la.so:
+ rm -f $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
$(LN_S) -f .libs/$@ $@
build_triplet = @build@
host_triplet = @host@
@OS_WIN32_TRUE@am__append_1 = \
-@OS_WIN32_TRUE@ -no-undefined \
-@OS_WIN32_TRUE@ -shrext ".pyd"
+@OS_WIN32_TRUE@ -no-undefined
@PLATFORM_WIN32_TRUE@am__append_2 = -DPLATFORM_WIN32
subdir = gi/_glib
libpyglib-gi-2.0-@PYTHON_BASENAME@.la
am__glib_la_OBJECTS = _glib_la-glibmodule.lo \
_glib_la-pygoptioncontext.lo _glib_la-pygoptiongroup.lo \
- _glib_la-pygsource.lo _glib_la-pygspawn.lo
+ _glib_la-pygspawn.lo
_glib_la_OBJECTS = $(am__glib_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
$(PYTHON_INCLUDES) \
-DPY_SSIZE_T_CLEAN
-extension_ldflags = -module -avoid-version $(am__append_1)
+extension_ldflags = -module -avoid-version -shrext $(PYTHON_SO) \
+ $(am__append_1)
# Windows requires Python modules to be explicitly linked to libpython.
# Extension modules are shared libaries (.dll), but need to be
pygoptioncontext.h \
pygoptiongroup.c \
pygoptiongroup.h \
- pygsource.c \
- pygsource.h \
pygspawn.c \
pygspawn.h
all: all-am
.SUFFIXES:
-.SUFFIXES: .c .la .lo .o .obj .so
+.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-glibmodule.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygoptioncontext.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygoptiongroup.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygsource.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygspawn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.Plo@am__quote@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygoptiongroup.lo `test -f 'pygoptiongroup.c' || echo '$(srcdir)/'`pygoptiongroup.c
-_glib_la-pygsource.lo: pygsource.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygsource.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygsource.Tpo -c -o _glib_la-pygsource.lo `test -f 'pygsource.c' || echo '$(srcdir)/'`pygsource.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_glib_la-pygsource.Tpo $(DEPDIR)/_glib_la-pygsource.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygsource.c' object='_glib_la-pygsource.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygsource.lo `test -f 'pygsource.c' || echo '$(srcdir)/'`pygsource.c
-
_glib_la-pygspawn.lo: pygspawn.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygspawn.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygspawn.Tpo -c -o _glib_la-pygspawn.lo `test -f 'pygspawn.c' || echo '$(srcdir)/'`pygspawn.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_glib_la-pygspawn.Tpo $(DEPDIR)/_glib_la-pygspawn.Plo
[ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
done
-all: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
clean-local:
- rm -f $(pyglib_LTLIBRARIES:.la=.so)
-.la.so:
+ rm -f $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
$(LN_S) -f .libs/$@ $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
#include "pyglib-private.h"
#include "pygoptioncontext.h"
#include "pygoptiongroup.h"
-#include "pygsource.h"
#include "pygspawn.h"
/* ---------------- glib module functions -------------------- */
-static PyObject *
-pyglib_threads_init(PyObject *unused, PyObject *args, PyObject *kwargs)
-{
- if (!pyglib_enable_threads())
- return NULL;
-
- Py_INCREF(Py_None);
- return Py_None;
-}
-
static PyMethodDef _glib_functions[] = {
- { "threads_init",
- (PyCFunction) pyglib_threads_init, METH_NOARGS,
- "threads_init()\n"
- "Initialize GLib for use from multiple threads. If you also use GTK+\n"
- "itself (i.e. GUI, not just PyGObject), use gtk.gdk.threads_init()\n"
- "instead." },
{ "spawn_async",
(PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS,
"spawn_async(argv, envp=None, working_directory=None,\n"
pyglib_register_api(d);
pyglib_register_error(d);
- pyglib_source_register_types(d);
pyglib_spawn_register_types(d);
pyglib_option_context_register_types(d);
pyglib_option_group_register_types(d);
#ifndef __PYGLIB_PYTHON_COMPAT_H__
#define __PYGLIB_PYTHON_COMPAT_H__
-/* Python 2.3 does not define Py_CLEAR */
-#ifndef Py_CLEAR
-#define Py_CLEAR(op) \
- do { \
- if (op) { \
- PyObject *tmp = (PyObject *)(op); \
- (op) = NULL; \
- Py_DECREF(tmp); \
- } \
- } while (0)
-#endif
-
-/* PyCObject superceded by PyCapsule on Python >= 2.7
- * However since this effects header files used by
- * static bindings we are only applying the change to
- * Python 3.x where we don't support the static bindings.
- * 3.2 removed PyCObject so we don't have any choice here.
- *
- * There is talk upstream of undeprecating PyCObject
- * (at least where the 2.x branch is concerned)
- * and there is no danger of it being remove from 2.7.
- **/
-#if PY_VERSION_HEX >= 0x03000000
# define PYGLIB_CPointer_Check PyCapsule_CheckExact
# define PYGLIB_CPointer_WrapPointer(ptr, typename) \
PyCapsule_New(ptr, typename, NULL)
PyCapsule_GetPointer(obj, typename)
# define PYGLIB_CPointer_Import(module, symbol) \
PyCapsule_Import(##module##.##symbol##, FALSE)
-#else
-# define PYGLIB_CPointer_Check PyCObject_Check
-# define PYGLIB_CPointer_WrapPointer(ptr, typename) \
- PyCObject_FromVoidPtr(ptr, NULL)
-# define PYGLIB_CPointer_GetPointer(obj, typename) \
- PyCObject_AsVoidPtr(obj)
-# define PYGLIB_CPointer_Import(module, symbol) \
- PyCObject_Import(module, symbol)
-#endif
#if PY_VERSION_HEX < 0x03000000
#include "pygoptiongroup.h"
static struct _PyGLib_Functions *_PyGLib_API;
-static int pyglib_thread_state_tls_key;
static PyObject *exception_table = NULL;
void
_PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(api, "gi._glib._PyGLib_API");
}
-gboolean
-pyglib_threads_enabled(void)
-{
- g_return_val_if_fail (_PyGLib_API != NULL, FALSE);
-
- return _PyGLib_API->threads_enabled;
-}
-
-PyGILState_STATE
-pyglib_gil_state_ensure(void)
-{
- g_return_val_if_fail (_PyGLib_API != NULL, PyGILState_LOCKED);
-
- if (!_PyGLib_API->threads_enabled)
- return PyGILState_LOCKED;
-
-#ifdef DISABLE_THREADING
- return PyGILState_LOCKED;
-#else
- return PyGILState_Ensure();
-#endif
-}
-
-void
-pyglib_gil_state_release(PyGILState_STATE state)
-{
- g_return_if_fail (_PyGLib_API != NULL);
-
- if (!_PyGLib_API->threads_enabled)
- return;
-
-#ifndef DISABLE_THREADING
- PyGILState_Release(state);
-#endif
-}
-
-/**
- * pyglib_enable_threads:
- *
- * Returns: TRUE if threading is enabled, FALSE otherwise.
- *
- */
-#ifdef DISABLE_THREADING
-gboolean
-pyglib_enable_threads(void)
-{
- PyErr_SetString(PyExc_RuntimeError,
- "pyglib threading disabled at compile time");
- return FALSE;
-}
-
-void
-_pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback)
-{
- /* Ignore, threads cannot be enabled. */
-}
-
-#else
-
-static GSList *thread_enabling_callbacks = NULL;
-
-/* Enable threading; note that the GIL must be held by the current
- * thread when this function is called
- */
-gboolean
-pyglib_enable_threads(void)
-{
- GSList *callback;
-
- g_return_val_if_fail (_PyGLib_API != NULL, FALSE);
-
- if (_PyGLib_API->threads_enabled)
- return TRUE;
-
- PyEval_InitThreads();
- _PyGLib_API->threads_enabled = TRUE;
- pyglib_thread_state_tls_key = PyThread_create_key();
-
- for (callback = thread_enabling_callbacks; callback; callback = callback->next)
- ((PyGLibThreadsEnabledFunc) callback->data) ();
-
- g_slist_free(thread_enabling_callbacks);
- return TRUE;
-}
-
-void
-_pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback)
-{
- if (callback && !pyglib_threads_enabled())
- thread_enabling_callbacks = g_slist_append(thread_enabling_callbacks, callback);
-}
-#endif
-
/**
* pyglib_block_threads:
*
void pyglib_init(void);
void pyglib_init_internal(PyObject *api);
-PyGILState_STATE pyglib_gil_state_ensure(void);
-void pyglib_gil_state_release(PyGILState_STATE state);
-int pyglib_enable_threads(void);
+
+#ifdef DISABLE_THREADING
+# define pyglib_gil_state_ensure() PyGILState_LOCKED
+# define pyglib_gil_state_release(state) state
+# define pyglib_begin_allow_threads G_STMT_START {
+# define pyglib_end_allow_threads } G_STMT_END
+#else
+# define pyglib_gil_state_ensure PyGILState_Ensure
+# define pyglib_gil_state_release PyGILState_Release
+# define pyglib_begin_allow_threads Py_BEGIN_ALLOW_THREADS
+# define pyglib_end_allow_threads Py_END_ALLOW_THREADS
+#endif
+
gboolean pyglib_error_check(GError **error);
PyObject *pyglib_error_marshal (GError **error);
gboolean pyglib_gerror_exception_check(GError **error);
PyObject *pyglib_register_exception_for_domain(gchar *name,
gint error_domain);
-gboolean pyglib_threads_enabled(void);
void pyglib_set_thread_block_funcs(PyGLibThreadBlockFunc block_threads_func,
PyGLibThreadBlockFunc unblock_threads_func);
void pyglib_block_threads(void);
GOptionGroup * pyglib_option_group_transfer_group(PyObject *self);
/* Private: for gobject <-> glib interaction only. */
-void _pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback);
PyObject* _pyglib_generic_ptr_richcompare(void* a, void *b, int op);
PyObject* _pyglib_generic_long_richcompare(long a, long b, int op);
-#define pyglib_begin_allow_threads \
- G_STMT_START { \
- PyThreadState *_save = NULL; \
- if (pyglib_threads_enabled()) \
- _save = PyEval_SaveThread();
-
-#define pyglib_end_allow_threads \
- if (pyglib_threads_enabled()) \
- PyEval_RestoreThread(_save); \
- } G_STMT_END
#define PYGLIB_REGISTER_TYPE(d, type, name) \
if (!type.tp_alloc) \
+++ /dev/null
-/* -*- Mode: C; c-basic-offset: 4 -*-
- * pygtk- Python bindings for the GTK toolkit.
- * Copyright (C) 1998-2003 James Henstridge
- * Copyright (C) 2005 Oracle
- *
- * Author: Manish Singh <manish.singh@oracle.com>
- *
- * pygsource.c: GSource wrapper
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <Python.h>
-#include <structmember.h> /* for PyMemberDef */
-#include "pyglib.h"
-#include "pyglib-private.h"
-#include "pygsource.h"
-
-/* glib.PollFD */
-
-PYGLIB_DEFINE_TYPE("gi._glib.PollFD", PyGPollFD_Type, PyGPollFD)
-
-static PyMemberDef pyg_poll_fd_members[] = {
- { "fd", T_INT, offsetof(PyGPollFD, pollfd.fd), READONLY },
- { "events", T_USHORT, offsetof(PyGPollFD, pollfd.events), READONLY },
- { "revents", T_USHORT, offsetof(PyGPollFD, pollfd.revents), READONLY },
- { NULL, 0, 0, 0 }
-};
-
-static void
-pyg_poll_fd_dealloc(PyGPollFD *self)
-{
- Py_XDECREF(self->fd_obj);
- PyObject_DEL(self);
-}
-
-static PyObject *
-pyg_poll_fd_repr(PyGPollFD *self)
-{
- return PYGLIB_PyUnicode_FromFormat("<GPollFD %d (%d) at 0x%lx>",
- self->pollfd.fd, self->pollfd.events,
- (long)self);
-}
-
-static int
-pyg_poll_fd_init(PyGPollFD *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "fd", "events", NULL };
- PyObject *o;
- gint fd;
- gushort events;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "OH:gi._glib.PollFD.__init__", kwlist,
- &o, &events))
- return -1;
-
- fd = PyObject_AsFileDescriptor(o);
- if (fd == -1)
- return -1;
-
- self->pollfd.fd = fd;
- self->pollfd.events = events;
- self->pollfd.revents = 0;
-
- Py_INCREF(o);
- self->fd_obj = o;
-
- return 0;
-}
-
-void
-pyglib_source_register_types(PyObject *d)
-{
- PyGPollFD_Type.tp_dealloc = (destructor)pyg_poll_fd_dealloc;
- PyGPollFD_Type.tp_repr = (reprfunc)pyg_poll_fd_repr;
- PyGPollFD_Type.tp_flags = Py_TPFLAGS_DEFAULT;
- PyGPollFD_Type.tp_members = pyg_poll_fd_members;
- PyGPollFD_Type.tp_init = (initproc)pyg_poll_fd_init;
- PYGLIB_REGISTER_TYPE(d, PyGPollFD_Type, "PollFD");
-}
+++ /dev/null
-/* -*- Mode: C; c-basic-offset: 4 -*-
- * pyglib - Python bindings for GLib toolkit.
- * Copyright (C) 1998-2003 James Henstridge
- * 2004-2008 Johan Dahlin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef __PYG_SOURCE_H__
-#define __PYG_SOURCE_H__
-
-extern PyTypeObject PyGPollFD_Type;
-
-typedef struct
-{
- PyObject_HEAD
- GPollFD pollfd;
- PyObject *fd_obj;
-} PyGPollFD;
-
-void pyglib_source_register_types(PyObject *d);
-
-#endif /* __PYG_SOURCE_H__ */
extension_ldflags = \
-module \
- -avoid-version
+ -avoid-version \
+ -shrext $(PYTHON_SO)
if OS_WIN32
# Windows requires Python modules to be explicitly linked to libpython.
$(PYTHON_LIBS)
extension_ldflags += \
- -no-undefined \
- -shrext ".pyd"
+ -no-undefined
endif
pygobjectdir = $(pyexecdir)/gi/_gobject
done
-all: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
clean-local:
- rm -f $(pygobject_LTLIBRARIES:.la=.so)
-.la.so:
+ rm -f $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
$(LN_S) -f .libs/$@ $@
build_triplet = @build@
host_triplet = @host@
@OS_WIN32_TRUE@am__append_1 = \
-@OS_WIN32_TRUE@ -no-undefined \
-@OS_WIN32_TRUE@ -shrext ".pyd"
+@OS_WIN32_TRUE@ -no-undefined
subdir = gi/_gobject
DIST_COMMON = $(pkginclude_HEADERS) $(pygobject_PYTHON) \
PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
$(PYTHON_INCLUDES) \
-DPY_SSIZE_T_CLEAN
-extension_ldflags = -module -avoid-version $(am__append_1)
+extension_ldflags = -module -avoid-version -shrext $(PYTHON_SO) \
+ $(am__append_1)
# Windows requires Python modules to be explicitly linked to libpython.
# Extension modules are shared libaries (.dll), but need to be
all: all-am
.SUFFIXES:
-.SUFFIXES: .c .la .lo .o .obj .so
+.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
[ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
done
-all: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
clean-local:
- rm -f $(pygobject_LTLIBRARIES:.la=.so)
-.la.so:
+ rm -f $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
$(LN_S) -f .libs/$@ $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
#endif
if (!PyArg_ParseTuple(args, "s:gobject.type_from_name", &name))
return NULL;
- type = _pyg_type_from_name(name);
+ type = g_type_from_name(name);
if (type != 0)
return pyg_type_wrapper_new(type);
repr = PyObject_Repr((PyObject*)self);
for (i = 0; type_name[i] != '\0'; i++)
if (type_name[i] == '.')
type_name[i] = '+';
- if (_pyg_type_from_name(type_name) == 0)
+ if (g_type_from_name(type_name) == 0)
break; /* we now have a unique name */
++name_serial;
}
g_type_set_qdata(instance_type, g_quark_from_string("PyGObject::class"),
class);
+ /* Mark this GType as a custom python type */
+ g_type_set_qdata(instance_type, pygobject_custom_key,
+ GINT_TO_POINTER (1));
+
/* set new value of __gtype__ on class */
gtype = pyg_type_wrapper_new(instance_type);
PyObject_SetAttrString((PyObject *)class, "__gtype__", gtype);
pyglib_gil_state_release(flag);
}
-static PyObject *
-pyg_threads_init (PyObject *unused, PyObject *args, PyObject *kwargs)
-{
- if (!pyglib_enable_threads())
- return NULL;
-
- Py_INCREF(Py_None);
- return Py_None;
-}
-
/* Only for backwards compatibility */
static int
pygobject_enable_threads(void)
{
- if (!pyglib_enable_threads())
- return -1;
return 0;
}
-static void
-pyg_note_threads_enabled(void)
-{
- pygobject_api_functions.threads_enabled = TRUE;
-}
-
static PyObject *
pyg_signal_accumulator_true_handled(PyObject *unused, PyObject *args)
{
pyg_object_class_list_properties, METH_VARARGS },
{ "new",
(PyCFunction)pyg_object_new, METH_VARARGS|METH_KEYWORDS },
- { "threads_init",
- (PyCFunction)pyg_threads_init, METH_VARARGS|METH_KEYWORDS },
{ "signal_accumulator_true_handled",
(PyCFunction)pyg_signal_accumulator_true_handled, METH_VARARGS },
{ "add_emission_hook",
pyg_flags_add,
pyg_flags_from_gtype,
- FALSE, /* threads_enabled */
+ /* threads_enabled */
+#ifdef DISABLE_THREADING
+ FALSE,
+#else
+ TRUE,
+#endif
+
pygobject_enable_threads,
pygobject_gil_state_ensure,
pygobject_gil_state_release,
add_warning_redirection,
disable_warning_redirections,
- pyg_type_register_custom_callback,
+ NULL, /* previously type_register_custom */
+
pyg_gerror_exception_check,
pyglib_option_group_new,
{
PyObject *d;
-#if !defined(GLIB_VERSION_2_36)
- g_type_init();
-#endif
pyglib_init();
d = PyModule_GetDict(module);
pygobject_pointer_register_types(d);
pygobject_enum_register_types(d);
pygobject_flags_register_types(d);
-
- pygobject_api_functions.threads_enabled = pyglib_threads_enabled();
- _pyglib_notify_on_enabling_threads(pyg_note_threads_enabled);
}
PYGLIB_MODULE_END
pyg_flags_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "value", NULL };
- guint value;
+ gulong value;
PyObject *pytc, *values, *ret, *pyint;
GType gtype;
GFlagsClass *eclass;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l", kwlist, &value))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k", kwlist, &value))
return NULL;
pytc = PyObject_GetAttrString((PyObject *)type, "__gtype__");
extern GQuark pygpointer_class_key;
extern GQuark pygobject_has_updated_constructor_key;
extern GQuark pygobject_instance_data_key;
+extern GQuark pygobject_custom_key;
void pygobject_data_free (PyGObjectData *data);
void pyg_destroy_notify (gpointer user_data);
int value);
/* pygtype.c */
-extern GHashTable *custom_type_registration;
-void pyg_type_register_custom_callback(const gchar *type_name,
- PyGTypeRegistrationFunction callback,
- gpointer data);
-PyTypeObject * pyg_type_get_custom(const gchar *name);
-GType _pyg_type_from_name(const gchar *name);
+extern gboolean pyg_gtype_is_custom (GType gtype);
/* pygobject.c */
extern PyTypeObject PyGObjectWeakRef_Type;
static void pygobject_find_slot_for(PyTypeObject *type, PyObject *bases, int slot_offset,
gboolean check_for_present);
GType PY_TYPE_OBJECT = 0;
+GQuark pygobject_custom_key;
GQuark pygobject_class_key;
GQuark pygobject_class_init_key;
GQuark pygobject_wrapper_key;
}
-GHashTable *custom_type_registration = NULL;
-
PyTypeObject *PyGObject_MetaType = NULL;
/**
return pyg_param_spec_new(pspec);
}
- /* See if the property's class is from the gi repository. If so,
- * use gi to correctly read the property value. */
- ret = pygi_get_property_value (self->pygobject, pspec);
- if (ret != NULL) {
- return ret;
+ if (!pyg_gtype_is_custom (pspec->owner_type)) {
+ /* The GType is not implemented at the Python level: see if we can
+ * read the property value via gi. */
+ ret = pygi_get_property_value (self->pygobject, pspec);
+ if (ret)
+ return ret;
}
-
- /* If we reach here, it must be a property defined outside of gi.
- * Just do a straightforward read. */
+
+ /* The GType is implemented in Python, or we failed to read it via gi:
+ * do a straightforward read. */
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec));
pyg_begin_allow_threads;
g_object_get_property(self->pygobject->obj, pspec->name, &value);
if (!pspec) {
return PyObject_GenericSetAttr((PyObject *)self, attr, pvalue);
}
-
- /* See if the property's class is from the gi repository. If so,
- * use gi to correctly read the property value. */
- ret = pygi_set_property_value (self->pygobject, pspec, pvalue);
- if (ret == 0)
- return 0;
- else if (ret == -1)
- if (PyErr_Occurred())
+ if (!pyg_gtype_is_custom (pspec->owner_type)) {
+ /* This GType is not implemented in Python: see if we can set the
+ * property via gi. */
+ ret = pygi_set_property_value (self->pygobject, pspec, pvalue);
+ if (ret == 0)
+ return 0;
+ else if (ret == -1 && PyErr_Occurred())
return -1;
+ }
- /* If we reach here, it must be a property defined outside of gi.
- * Just do a straightforward set. */
+ /* This GType is implemented in Python, or we failed to set it via gi:
+ * do a straightforward set. */
if (!set_property_from_pspec(obj, pspec, pvalue))
return -1;
if (gtype == G_TYPE_INTERFACE)
return &PyGInterface_Type;
- py_type = pyg_type_get_custom(g_type_name(gtype));
- if (py_type)
- return py_type;
-
py_type = g_type_get_qdata(gtype, pygobject_class_key);
if (py_type == NULL) {
py_type = g_type_get_qdata(gtype, pyginterface_type_key);
return pygbinding_weak_ref_new(G_OBJECT (binding));
}
+static PyObject *
+connect_helper(PyGObject *self, gchar *name, PyObject *callback, PyObject *extra_args, PyObject *object, gboolean after)
+{
+ guint sigid;
+ GQuark detail = 0;
+ GClosure *closure = NULL;
+ gulong handlerid;
+ GSignalQuery query_info;
+
+ if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
+ &sigid, &detail, TRUE)) {
+ PyObject *repr = PyObject_Repr((PyObject*)self);
+ PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
+ PYGLIB_PyUnicode_AsString(repr),
+ name);
+ Py_DECREF(repr);
+ return NULL;
+ }
+
+ g_signal_query (sigid, &query_info);
+ if (!pyg_gtype_is_custom (query_info.itype)) {
+ /* The signal is implemented by a non-Python class, probably
+ * something in the gi repository. */
+ closure = pygi_signal_closure_new (self, query_info.itype,
+ query_info.signal_name, callback,
+ extra_args, object);
+ }
+
+ if (!closure) {
+ /* The signal is either implemented at the Python level, or it comes
+ * from a foreign class that we don't have introspection data for. */
+ closure = pyg_closure_new (callback, extra_args, object);
+ }
+
+ pygobject_watch_closure((PyObject *)self, closure);
+ handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
+ closure, after);
+ return PyLong_FromUnsignedLong(handlerid);
+}
+
static PyObject *
pygobject_connect(PyGObject *self, PyObject *args)
{
- PyObject *first, *callback, *extra_args, *repr = NULL;
+ PyObject *first, *callback, *extra_args, *ret;
gchar *name;
- guint sigid, len;
- gulong handlerid;
- GQuark detail = 0;
- GClosure *closure;
+ guint len;
len = PyTuple_Size(args);
if (len < 2) {
CHECK_GOBJECT(self);
- if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
- &sigid, &detail, TRUE)) {
- repr = PyObject_Repr((PyObject*)self);
- PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
- PYGLIB_PyUnicode_AsString(repr),
- name);
- Py_DECREF(repr);
- return NULL;
- }
extra_args = PySequence_GetSlice(args, 2, len);
if (extra_args == NULL)
return NULL;
- closure = pygi_signal_closure_new(self, name, callback, extra_args, NULL);
- if (closure == NULL)
- closure = pyg_closure_new(callback, extra_args, NULL);
-
- pygobject_watch_closure((PyObject *)self, closure);
- handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
- closure, FALSE);
+ ret = connect_helper(self, name, callback, extra_args, NULL, FALSE);
Py_DECREF(extra_args);
- return PyLong_FromUnsignedLong(handlerid);
+ return ret;
}
static PyObject *
pygobject_connect_after(PyGObject *self, PyObject *args)
{
- PyObject *first, *callback, *extra_args, *repr = NULL;
+ PyObject *first, *callback, *extra_args, *ret;
gchar *name;
- guint sigid;
- gulong handlerid;
Py_ssize_t len;
- GQuark detail;
- GClosure *closure;
len = PyTuple_Size(args);
if (len < 2) {
CHECK_GOBJECT(self);
- if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
- &sigid, &detail, TRUE)) {
- repr = PyObject_Repr((PyObject*)self);
- PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
- PYGLIB_PyUnicode_AsString(repr),
- name);
- Py_DECREF(repr);
- return NULL;
- }
extra_args = PySequence_GetSlice(args, 2, len);
if (extra_args == NULL)
return NULL;
- closure = pygi_signal_closure_new(self, name, callback, extra_args, NULL);
- if (closure == NULL)
- closure = pyg_closure_new(callback, extra_args, NULL);
-
- pygobject_watch_closure((PyObject *)self, closure);
- handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
- closure, TRUE);
+ ret = connect_helper(self, name, callback, extra_args, NULL, TRUE);
Py_DECREF(extra_args);
- return PyLong_FromUnsignedLong(handlerid);
+ return ret;
}
static PyObject *
pygobject_connect_object(PyGObject *self, PyObject *args)
{
- PyObject *first, *callback, *extra_args, *object, *repr = NULL;
+ PyObject *first, *callback, *extra_args, *object, *ret;
gchar *name;
- guint sigid;
- gulong handlerid;
Py_ssize_t len;
- GQuark detail;
- GClosure *closure;
len = PyTuple_Size(args);
if (len < 3) {
CHECK_GOBJECT(self);
- if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
- &sigid, &detail, TRUE)) {
- repr = PyObject_Repr((PyObject*)self);
- PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
- PYGLIB_PyUnicode_AsString(repr),
- name);
- Py_DECREF(repr);
- return NULL;
- }
extra_args = PySequence_GetSlice(args, 3, len);
if (extra_args == NULL)
return NULL;
- closure = pygi_signal_closure_new(self, name, callback, extra_args, object);
- if (closure == NULL)
- closure = pyg_closure_new(callback, extra_args, object);
-
- pygobject_watch_closure((PyObject *)self, closure);
- handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
- closure, FALSE);
+ ret = connect_helper(self, name, callback, extra_args, object, FALSE);
Py_DECREF(extra_args);
- return PyLong_FromUnsignedLong(handlerid);
+ return ret;
}
static PyObject *
pygobject_connect_object_after(PyGObject *self, PyObject *args)
{
- PyObject *first, *callback, *extra_args, *object, *repr = NULL;
+ PyObject *first, *callback, *extra_args, *object, *ret;
gchar *name;
- guint sigid;
- gulong handlerid;
Py_ssize_t len;
- GQuark detail;
- GClosure *closure;
len = PyTuple_Size(args);
if (len < 3) {
CHECK_GOBJECT(self);
- if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
- &sigid, &detail, TRUE)) {
- repr = PyObject_Repr((PyObject*)self);
- PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
- PYGLIB_PyUnicode_AsString(repr),
- name);
- Py_DECREF(repr);
- return NULL;
- }
extra_args = PySequence_GetSlice(args, 3, len);
if (extra_args == NULL)
return NULL;
- closure = pygi_signal_closure_new(self, name, callback, extra_args, object);
- if (closure == NULL)
- closure = pyg_closure_new(callback, extra_args, object);
-
- pygobject_watch_closure((PyObject *)self, closure);
- handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
- closure, TRUE);
+ ret = connect_helper(self, name, callback, extra_args, object, TRUE);
Py_DECREF(extra_args);
- return PyLong_FromUnsignedLong(handlerid);
+ return ret;
}
static PyObject *
{
PyObject *o, *descr;
+ pygobject_custom_key = g_quark_from_static_string("PyGObject::custom");
pygobject_class_key = g_quark_from_static_string("PyGObject::class");
pygobject_class_init_key = g_quark_from_static_string("PyGObject::class-init");
pygobject_wrapper_key = g_quark_from_static_string("PyGObject::wrapper");
void (*add_warning_redirection) (const char *domain,
PyObject *warning);
void (*disable_warning_redirections) (void);
- void (*type_register_custom)(const gchar *type_name,
- PyGTypeRegistrationFunction callback,
- gpointer data);
+
+ /* type_register_custom API now removed, but leave a pointer here to not
+ * break ABI. */
+ void *_type_register_custom;
+
gboolean (*gerror_exception_check) (GError **error);
PyObject* (*option_group_new) (GOptionGroup *group);
GType (* type_from_object_strict) (PyObject *obj, gboolean strict);
#define pyg_register_interface_info (_PyGObject_API->register_interface_info)
#define pyg_add_warning_redirection (_PyGObject_API->add_warning_redirection)
#define pyg_disable_warning_redirections (_PyGObject_API->disable_warning_redirections)
-#define pyg_type_register_custom_callback (_PyGObject_API->type_register_custom)
#define pyg_gerror_exception_check (_PyGObject_API->gerror_exception_check)
#define pyg_option_group_new (_PyGObject_API->option_group_new)
}
cobject = PyObject_GetAttrString(gobject, "_PyGObject_API");
-#if PY_VERSION_HEX >= 0x03000000
if (cobject && PyCapsule_CheckExact(cobject))
_PyGObject_API = (struct _PyGObject_Functions *) PyCapsule_GetPointer(cobject, "gobject._PyGObject_API");
-
-#else
- if (cobject && PyCObject_Check(cobject))
- _PyGObject_API = (struct _PyGObject_Functions *) PyCObject_AsVoidPtr(cobject);
-#endif
else {
PyErr_SetString(PyExc_ImportError,
"could not import gobject (could not find _PyGObject_API object)");
if (!PyArg_ParseTuple(args, "s:GType.from_name", &type_name))
return NULL;
- type = _pyg_type_from_name(type_name);
+ type = g_type_from_name(type_name);
if (type == 0) {
PyErr_SetString(PyExc_RuntimeError, "unknown type name");
return NULL;
if (PYGLIB_PyUnicode_Check(obj)) {
gchar *name = PYGLIB_PyUnicode_AsString(obj);
- type = _pyg_type_from_name(name);
+ type = g_type_from_name(name);
if (type != 0) {
return type;
}
}
}
-/**
- * pyg_type_registration_callback
- * @gtypename: type name
- * @callback: function to run
- *
- */
-typedef struct {
- PyGTypeRegistrationFunction callback;
- gpointer data;
-} CustomTypeData;
-
-void
-pyg_type_register_custom_callback(const gchar *typename,
- PyGTypeRegistrationFunction callback,
- gpointer user_data)
+gboolean
+pyg_gtype_is_custom(GType gtype)
{
- CustomTypeData *data;
-
- if (!custom_type_registration)
- custom_type_registration = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, g_free);
-
- data = g_new (CustomTypeData, 1);
- data->callback = callback;
- data->data = user_data;
-
- g_hash_table_insert(custom_type_registration,
- g_strdup(typename),
- data);
-}
-
-PyTypeObject *
-pyg_type_get_custom(const gchar *name)
-{
- CustomTypeData *data;
- PyTypeObject *retval;
-
- if (!custom_type_registration)
- return NULL;
-
- data = g_hash_table_lookup(custom_type_registration, name);
- if (!data)
- return NULL;
-
- retval = data->callback(name, data->data);
-
- g_hash_table_remove(custom_type_registration, name);
-
- return retval;
-}
-
-GType
-_pyg_type_from_name(const gchar *name)
-{
- GType type;
-
- type = g_type_from_name(name);
- if (type == G_TYPE_INVALID) {
- pyg_type_get_custom(name);
- type = g_type_from_name(name);
- }
-
- return type;
+ return g_type_get_qdata (gtype, pygobject_custom_key) != NULL;
}
static PyObject *
self._version = version
self.__name__ = 'gi.repository.' + namespace
- repository.require(self._namespace, self._version)
self.__path__ = repository.get_typelib_path(self._namespace)
if _have_py3:
# get_typelib_path() delivers bytes, not a string
OptionContext = _glib.OptionContext
OptionGroup = _glib.OptionGroup
Pid = _glib.Pid
-PollFD = _glib.PollFD
spawn_async = _glib.spawn_async
-threads_init = _glib.threads_init
-__all__ += ['GError', 'OptionContext', 'OptionGroup', 'Pid', 'PollFD',
+
+def threads_init():
+ warnings.warn('threads_init longer needs to be called. '
+ 'See: https://bugzilla.gnome.org/show_bug.cgi?id=686914',
+ PyGIDeprecationWarning)
+
+
+__all__ += ['GError', 'OptionContext', 'OptionGroup', 'Pid',
'spawn_async', 'threads_init']
__all__.append('IOChannel')
+class PollFD(GLib.PollFD):
+ def __new__(cls, fd, events):
+ pollfd = GLib.PollFD()
+ pollfd.__class__ = cls
+ return pollfd
+
+ def __init__(self, fd, events):
+ self.fd = fd
+ self.events = events
+
+PollFD = override(PollFD)
+__all__.append('PollFD')
+
+
# The real GLib API is child_watch_add(priority, pid, callback, data).
# The old static bindings had the following API which we still need to support
# for a while:
list_properties = _gobject.list_properties
new = _gobject.new
pygobject_version = _gobject.pygobject_version
-threads_init = _gobject.threads_init
+threads_init = GLib.threads_init
type_register = _gobject.type_register
__all__ += ['features', 'list_properties', 'new',
'pygobject_version', 'threads_init', 'type_register']
def insert_text(self, text, position):
return super(Editable, self).insert_text(text, -1, position)
- get_selection_bounds = strip_boolean_result(Gtk.TextBuffer.get_selection_bounds, fail_ret=())
+ get_selection_bounds = strip_boolean_result(Gtk.Editable.get_selection_bounds, fail_ret=())
Editable = override(Editable)
PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
}
case GI_TYPE_TAG_FLOAT:
{
- PyObject *float_;
-
- float_ = PyNumber_Float (object);
- if (float_ == NULL) {
- PyErr_SetString (PyExc_TypeError, "expected float or int argument");
- break;
- }
-
- arg.v_float = (float) PyFloat_AsDouble (float_);
- Py_DECREF (float_);
-
+ _pygi_marshal_from_py_float (NULL, NULL, NULL,
+ object, &arg);
break;
}
case GI_TYPE_TAG_DOUBLE:
{
- PyObject *float_;
-
- float_ = PyNumber_Float (object);
- if (float_ == NULL) {
- PyErr_SetString (PyExc_TypeError, "expected float or int argument");
- break;
- }
-
- arg.v_double = PyFloat_AsDouble (float_);
- Py_DECREF (float_);
-
+ _pygi_marshal_from_py_double (NULL, NULL, NULL,
+ object, &arg);
break;
}
case GI_TYPE_TAG_GTYPE:
}
case GI_TYPE_TAG_UNICHAR:
{
- gchar *string;
-
- if (object == Py_None) {
- arg.v_uint32 = 0;
- break;
- }
-
-#if PY_VERSION_HEX < 0x03000000
- if (PyUnicode_Check(object)) {
- PyObject *pystr_obj = PyUnicode_AsUTF8String (object);
-
- if (!pystr_obj)
- break;
-
- string = g_strdup(PyString_AsString (pystr_obj));
- Py_DECREF(pystr_obj);
- } else {
- string = g_strdup(PyString_AsString (object));
- }
-#else
- {
- PyObject *pybytes_obj = PyUnicode_AsUTF8String (object);
- if (!pybytes_obj)
- break;
-
- string = g_strdup(PyBytes_AsString (pybytes_obj));
- Py_DECREF (pybytes_obj);
- }
-#endif
-
- arg.v_uint32 = g_utf8_get_char (string);
-
+ _pygi_marshal_from_py_unichar (NULL, NULL, NULL,
+ object, &arg);
break;
}
case GI_TYPE_TAG_UTF8:
{
- gchar *string;
-
- if (object == Py_None) {
- arg.v_string = NULL;
- break;
- }
-#if PY_VERSION_HEX < 0x03000000
- if (PyUnicode_Check(object)) {
- PyObject *pystr_obj = PyUnicode_AsUTF8String (object);
-
- if (!pystr_obj)
- break;
-
- string = g_strdup(PyString_AsString (pystr_obj));
- Py_DECREF(pystr_obj);
- } else {
- string = g_strdup(PyString_AsString (object));
- }
-#else
- {
- PyObject *pybytes_obj = PyUnicode_AsUTF8String (object);
- if (!pybytes_obj)
- break;
-
- string = g_strdup(PyBytes_AsString (pybytes_obj));
- Py_DECREF (pybytes_obj);
- }
-#endif
- arg.v_string = string;
-
+ _pygi_marshal_from_py_utf8 (NULL, NULL, NULL,
+ object, &arg);
break;
}
case GI_TYPE_TAG_FILENAME:
{
- GError *error = NULL;
- gchar *string;
-
-#if PY_VERSION_HEX < 0x03000000
- string = g_strdup(PyString_AsString (object));
-#else
- {
- PyObject *pybytes_obj = PyUnicode_AsUTF8String (object);
- if (!pybytes_obj)
- break;
-
- string = g_strdup(PyBytes_AsString (pybytes_obj));
- Py_DECREF (pybytes_obj);
- }
-#endif
-
- if (string == NULL) {
- break;
- }
-
- arg.v_string = g_filename_from_utf8 (string, -1, NULL, NULL, &error);
- g_free(string);
-
- if (arg.v_string == NULL) {
- PyErr_SetString (PyExc_Exception, error->message);
- /* TODO: Convert the error to an exception. */
- }
-
+ _pygi_marshal_from_py_filename (NULL, NULL, NULL,
+ object, &arg);
break;
}
case GI_TYPE_TAG_ARRAY:
case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_UNION:
{
- GType type;
-
- if (object == Py_None) {
- arg.v_pointer = NULL;
- break;
- }
-
- type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
-
- /* Handle special cases first. */
- if (g_type_is_a (type, G_TYPE_VALUE)) {
- g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
- /* This will currently leak the GValue that is allocated and
- * stashed in arg.v_pointer. Out argument marshaling for caller
- * allocated GValues already pass in memory for the GValue.
- * Further re-factoring is needed to fix this leak.
- * See: https://bugzilla.gnome.org/show_bug.cgi?id=693405
- */
- pygi_marshal_from_py_gvalue (object,
- &arg,
- transfer,
- FALSE /*is_allocated*/);
-
- } else if (g_type_is_a (type, G_TYPE_CLOSURE)) {
- pygi_marshal_from_py_gclosure (object, &arg);
- } else if (g_struct_info_is_foreign (info)) {
- pygi_struct_foreign_convert_to_g_argument (object, info, transfer, &arg);
- } else if (g_type_is_a (type, G_TYPE_BOXED)) {
- if (pyg_boxed_check (object, type)) {
- arg.v_pointer = pyg_boxed_get (object, void);
- if (transfer == GI_TRANSFER_EVERYTHING) {
- arg.v_pointer = g_boxed_copy (type, arg.v_pointer);
- }
- } else {
- PyErr_Format (PyExc_TypeError, "wrong boxed type");
- }
- } else if (g_type_is_a (type, G_TYPE_POINTER) ||
- g_type_is_a (type, G_TYPE_VARIANT) ||
- type == G_TYPE_NONE) {
- g_warn_if_fail (g_type_is_a (type, G_TYPE_VARIANT) || !g_type_info_is_pointer (type_info) || transfer == GI_TRANSFER_NOTHING);
-
- if (g_type_is_a (type, G_TYPE_VARIANT) && pyg_type_from_object (object) != G_TYPE_VARIANT) {
- PyErr_SetString (PyExc_TypeError, "expected GLib.Variant");
- break;
- }
- arg.v_pointer = pyg_pointer_get (object, void);
- } else {
- PyErr_Format (PyExc_NotImplementedError, "structure type '%s' is not supported yet", g_type_name (type));
- }
-
+ GType g_type;
+ PyObject *py_type;
+
+ g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
+ py_type = _pygi_type_import_by_gi_info ( (GIBaseInfo *) info);
+
+ /* Note for G_TYPE_VALUE g_type:
+ * This will currently leak the GValue that is allocated and
+ * stashed in arg.v_pointer. Out argument marshaling for caller
+ * allocated GValues already pass in memory for the GValue.
+ * Further re-factoring is needed to fix this leak.
+ * See: https://bugzilla.gnome.org/show_bug.cgi?id=693405
+ */
+ pygi_marshal_from_py_interface_struct (object,
+ &arg,
+ NULL, /*arg_name*/
+ info, /*interface_info*/
+ type_info,
+ g_type,
+ py_type,
+ transfer,
+ FALSE, /*is_caller_allocates*/
+ g_struct_info_is_foreign (info));
+
+ Py_DECREF (py_type);
break;
}
case GI_INFO_TYPE_ENUM:
switch (type_tag) {
case GI_TYPE_TAG_VOID:
{
- if (g_type_info_is_pointer (type_info) &&
- (arg->v_pointer != NULL)) {
+ if (g_type_info_is_pointer (type_info)) {
g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
object = PyLong_FromVoidPtr (arg->v_pointer);
- } else {
- /* None is used instead of zero for parity with ctypes.
- * This is helpful in case the values are being used for
- * actual memory addressing, in which case None will
- * raise as opposed to 0 which will crash.
- */
- object = Py_None;
- Py_INCREF (object);
}
break;
}
}
case GI_TYPE_TAG_UNICHAR:
{
- /* Preserve the bidirectional mapping between 0 and "" */
- if (arg->v_uint32 == 0) {
- object = PYGLIB_PyUnicode_FromString ("");
- } else if (g_unichar_validate (arg->v_uint32)) {
- gchar utf8[6];
- gint bytes;
-
- bytes = g_unichar_to_utf8 (arg->v_uint32, utf8);
- object = PYGLIB_PyUnicode_FromStringAndSize ((char*)utf8, bytes);
- } else {
- /* TODO: Convert the error to an exception. */
- PyErr_Format (PyExc_TypeError,
- "Invalid unicode codepoint %" G_GUINT32_FORMAT,
- arg->v_uint32);
- object = Py_None;
- Py_INCREF (object);
- }
+ object = _pygi_marshal_to_py_unichar (NULL, NULL, NULL,
+ arg);
break;
}
case GI_TYPE_TAG_UTF8:
- if (arg->v_string == NULL) {
- object = Py_None;
- Py_INCREF (object);
- break;
- }
-
- object = PYGLIB_PyUnicode_FromString (arg->v_string);
+ {
+ object = _pygi_marshal_to_py_utf8 (NULL, NULL, NULL,
+ arg);
break;
+ }
case GI_TYPE_TAG_FILENAME:
{
- GError *error = NULL;
- gchar *string;
-
- if (arg->v_string == NULL) {
- object = Py_None;
- Py_INCREF (object);
- break;
- }
-
- string = g_filename_to_utf8 (arg->v_string, -1, NULL, NULL, &error);
- if (string == NULL) {
- PyErr_SetString (PyExc_Exception, error->message);
- /* TODO: Convert the error to an exception. */
- break;
- }
-
- object = PYGLIB_PyUnicode_FromString (string);
-
- g_free (string);
-
+ object = _pygi_marshal_to_py_filename (NULL, NULL, NULL,
+ arg);
break;
}
case GI_TYPE_TAG_ARRAY:
case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_UNION:
{
- GType type;
-
- if (arg->v_pointer == NULL) {
- object = Py_None;
- Py_INCREF (object);
- break;
- }
-
- type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
- if (g_type_is_a (type, G_TYPE_VALUE)) {
- object = pyg_value_as_pyobject (arg->v_pointer, FALSE);
- } else if (g_struct_info_is_foreign (info)) {
- object = pygi_struct_foreign_convert_from_g_argument (info, arg->v_pointer);
- } else if (g_type_is_a (type, G_TYPE_BOXED)) {
- PyObject *py_type;
-
- py_type = _pygi_type_get_from_g_type (type);
- if (py_type == NULL)
- break;
+ PyObject *py_type;
+ GType g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
- object = _pygi_boxed_new ( (PyTypeObject *) py_type, arg->v_pointer, transfer == GI_TRANSFER_EVERYTHING, 0);
-
- Py_DECREF (py_type);
- } else if (g_type_is_a (type, G_TYPE_POINTER)) {
- PyObject *py_type;
-
- py_type = _pygi_type_get_from_g_type (type);
-
- if (py_type == NULL || !PyType_IsSubtype ( (PyTypeObject *) type, &PyGIStruct_Type)) {
- g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
- object = pyg_pointer_new (type, arg->v_pointer);
- } else {
- object = _pygi_struct_new ( (PyTypeObject *) py_type, arg->v_pointer, transfer == GI_TRANSFER_EVERYTHING);
- }
-
- Py_XDECREF (py_type);
- } else if (type == G_TYPE_VARIANT) {
- PyObject *py_type;
-
- g_variant_ref_sink (arg->v_pointer);
+ /* Special case variant and none to force loading from py module. */
+ if (g_type == G_TYPE_VARIANT || g_type == G_TYPE_NONE) {
py_type = _pygi_type_import_by_gi_info (info);
- object = _pygi_struct_new ( (PyTypeObject *) py_type, arg->v_pointer,
- transfer == GI_TRANSFER_EVERYTHING);
- } else if (type == G_TYPE_NONE) {
- PyObject *py_type;
-
- py_type = _pygi_type_import_by_gi_info (info);
- if (py_type == NULL) {
- break;
- }
-
- /* Only structs created in invoke can be safely marked
- * GI_TRANSFER_EVERYTHING. Trust that invoke has
- * filtered correctly
- */
- object = _pygi_struct_new ( (PyTypeObject *) py_type, arg->v_pointer,
- transfer == GI_TRANSFER_EVERYTHING);
-
- Py_DECREF (py_type);
} else {
- PyErr_Format (PyExc_NotImplementedError, "structure type '%s' is not supported yet", g_type_name (type));
+ py_type = _pygi_type_get_from_g_type (g_type);
}
+ object = pygi_marshal_to_py_interface_struct (arg,
+ info, /*interface_info*/
+ g_type,
+ py_type,
+ transfer,
+ FALSE, /*is_allocated*/
+ g_struct_info_is_foreign (info));
+
+ Py_XDECREF (py_type);
break;
}
case GI_INFO_TYPE_ENUM:
} else if (info_type == GI_INFO_TYPE_ENUM) {
object = pyg_enum_from_gtype (type, arg->v_int);
} else {
- object = pyg_flags_from_gtype (type, arg->v_int);
+ object = pyg_flags_from_gtype (type, arg->v_uint);
}
break;
switch (info_type) {
case GI_INFO_TYPE_FLAGS:
- arg.v_long = g_value_get_flags (value);
+ arg.v_uint = g_value_get_flags (value);
break;
case GI_INFO_TYPE_ENUM:
- arg.v_long = g_value_get_enum (value);
+ arg.v_int = g_value_get_enum (value);
break;
case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_OBJECT:
_arg_cache_to_py_interface_union_setup (arg_cache, transfer);
break;
+ case GI_INFO_TYPE_BOXED:
case GI_INFO_TYPE_STRUCT:
if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
_arg_cache_from_py_interface_struct_setup (arg_cache,
_arg_cache_to_py_interface_object_setup (arg_cache, transfer);
break;
- case GI_INFO_TYPE_BOXED:
- if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_from_py_interface_struct_setup (arg_cache,
- iface_info,
- transfer);
-
- if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
- _arg_cache_to_py_interface_struct_setup (arg_cache,
- iface_info,
- transfer);
- break;
case GI_INFO_TYPE_CALLBACK:
{
PyGICallbackCache *callback_cache;
PYGLIB_DEFINE_TYPE("gi.BaseInfo", PyGIBaseInfo_Type, PyGIBaseInfo);
-static PyObject *
-_wrap_g_base_info_get_name (PyGIBaseInfo *self)
+gboolean
+_pygi_is_python_keyword (const gchar *name)
{
/* It may be better to use keyword.iskeyword(); keep in sync with
* python -c 'import keyword; print(keyword.kwlist)' */
#error Need keyword list for this major Python version
#endif
- const gchar *name, **i;
-
- name = g_base_info_get_name (self->info);
+ const gchar **i;
- /* escape keywords */
for (i = keywords; *i != NULL; ++i) {
if (strcmp (name, *i) == 0) {
- gchar *escaped = g_strconcat (name, "_", NULL);
- PyObject *obj = PYGLIB_PyUnicode_FromString (escaped);
- g_free (escaped);
- return obj;
+ return TRUE;
}
}
+ return FALSE;
+}
+
+static PyObject *
+_wrap_g_base_info_get_name (PyGIBaseInfo *self)
+{
+ const gchar *name;
+
+ name = g_base_info_get_name (self->info);
+
+ /* escape keywords */
+ if (_pygi_is_python_keyword (name)) {
+ gchar *escaped = g_strconcat (name, "_", NULL);
+ PyObject *obj = PYGLIB_PyUnicode_FromString (escaped);
+ g_free (escaped);
+ return obj;
+ }
+
return PYGLIB_PyUnicode_FromString (name);
}
} else {
Py_DecRef(py_type);
if (type_tag == GI_TYPE_TAG_INTERFACE) {
+ const char *info_name;
+ PyObject *py_string;
GIBaseInfo *iface = g_type_info_get_interface(&type_info);
+
+ info_name = g_base_info_get_name (iface);
+ if (info_name == NULL) {
+ g_base_info_unref (iface);
+ return PYGLIB_PyUnicode_FromString(g_type_tag_to_string(type_tag));
+ }
+
gchar *name = g_strdup_printf("%s.%s",
g_base_info_get_namespace(iface),
- g_base_info_get_name (iface));
- PyObject *py_string;
+ info_name);
g_base_info_unref(iface);
py_string = PYGLIB_PyUnicode_FromString(name);
g_free(name);
return PyBool_FromLong (is_abstract);
}
+static PyObject *
+_wrap_g_object_info_get_class_struct (PyGIBaseInfo *self)
+{
+ GIBaseInfo *info;
+
+ info = g_object_info_get_class_struct ((GIObjectInfo*)self->info);
+
+ if (info == NULL) {
+ Py_RETURN_NONE;
+ }
+
+ return _pygi_info_new (info);
+}
+
static PyMethodDef _PyGIObjectInfo_methods[] = {
{ "get_parent", (PyCFunction) _wrap_g_object_info_get_parent, METH_NOARGS },
{ "get_methods", (PyCFunction) _wrap_g_object_info_get_methods, METH_NOARGS },
{ "get_constants", (PyCFunction) _wrap_g_object_info_get_constants, METH_NOARGS },
{ "get_vfuncs", (PyCFunction) _wrap_g_object_info_get_vfuncs, METH_NOARGS },
{ "get_abstract", (PyCFunction) _wrap_g_object_info_get_abstract, METH_NOARGS },
+ { "get_class_struct", (PyCFunction) _wrap_g_object_info_get_class_struct, METH_NOARGS },
{ NULL, NULL, 0 }
};
void _pygi_info_register_types (PyObject *m);
+gboolean _pygi_is_python_keyword (const gchar *name);
+
G_END_DECLS
#endif /* __PYGI_INFO_H__ */
* expected C union
*/
static gboolean
-_is_union_member (PyGIInterfaceCache *iface_cache, PyObject *py_arg) {
+_is_union_member (GIInterfaceInfo *interface_info, PyObject *py_arg) {
gint i;
gint n_fields;
GIUnionInfo *union_info;
GIInfoType info_type;
gboolean is_member = FALSE;
- info_type = g_base_info_get_type (iface_cache->interface_info);
+ info_type = g_base_info_get_type (interface_info);
if (info_type != GI_INFO_TYPE_UNION)
return FALSE;
- union_info = (GIUnionInfo *) iface_cache->interface_info;
+ union_info = (GIUnionInfo *) interface_info;
n_fields = g_union_info_get_n_fields (union_info);
for (i = 0; i < n_fields; i++) {
return TRUE;
}
-gboolean
-_pygi_marshal_from_py_float (PyGIInvokeState *state,
- PyGICallableCache *callable_cache,
- PyGIArgCache *arg_cache,
- PyObject *py_arg,
- GIArgument *arg)
+static gboolean
+_pygi_py_arg_to_double (PyObject *py_arg, double *double_)
{
PyObject *py_float;
- double double_;
if (!PyNumber_Check (py_arg)) {
PyErr_Format (PyExc_TypeError, "Must be number, not %s",
if (!py_float)
return FALSE;
- double_ = PyFloat_AsDouble (py_float);
+ *double_ = PyFloat_AsDouble (py_float);
Py_DECREF (py_float);
+
+ return TRUE;
+}
+
+gboolean
+_pygi_marshal_from_py_float (PyGIInvokeState *state,
+ PyGICallableCache *callable_cache,
+ PyGIArgCache *arg_cache,
+ PyObject *py_arg,
+ GIArgument *arg)
+{
+ double double_;
+
+ if (!_pygi_py_arg_to_double (py_arg, &double_))
+ return FALSE;
+
if (PyErr_Occurred () || !check_valid_double (double_, -G_MAXFLOAT, G_MAXFLOAT))
return FALSE;
arg->v_float = double_;
-
return TRUE;
}
PyObject *py_arg,
GIArgument *arg)
{
- PyObject *py_float;
double double_;
- if (!PyNumber_Check (py_arg)) {
- PyErr_Format (PyExc_TypeError, "Must be number, not %s",
- py_arg->ob_type->tp_name);
- return FALSE;
- }
-
- py_float = PyNumber_Float (py_arg);
- if (!py_float)
+ if (!_pygi_py_arg_to_double (py_arg, &double_))
return FALSE;
- double_ = PyFloat_AsDouble (py_float);
- Py_DECREF (py_float);
-
if (PyErr_Occurred () || !check_valid_double (double_, -G_MAXDOUBLE, G_MAXDOUBLE))
return FALSE;
arg->v_double = double_;
-
return TRUE;
}
Py_ssize_t size;
gchar *string_;
+ if (py_arg == Py_None) {
+ arg->v_uint32 = 0;
+ return FALSE;
+ }
+
if (PyUnicode_Check (py_arg)) {
PyObject *py_bytes;
size = PyUnicode_GET_SIZE (py_arg);
py_bytes = PyUnicode_AsUTF8String (py_arg);
- string_ = strdup(PYGLIB_PyBytes_AsString (py_bytes));
+ if (!py_bytes)
+ return FALSE;
+
+ string_ = g_strdup(PYGLIB_PyBytes_AsString (py_bytes));
Py_DECREF (py_bytes);
#if PY_VERSION_HEX < 0x03000000
return TRUE;
}
+
gboolean
_pygi_marshal_from_py_gtype (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
{
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
- if (py_arg == Py_None) {
- arg->v_pointer = NULL;
- return TRUE;
- }
-
- /* FIXME: handle this large if statement in the cache
- * and set the correct marshaller
- */
-
- if (iface_cache->g_type == G_TYPE_CLOSURE) {
- return pygi_marshal_from_py_gclosure (py_arg, arg);
- } else if (iface_cache->g_type == G_TYPE_VALUE) {
- return pygi_marshal_from_py_gvalue(py_arg, arg,
- arg_cache->transfer,
- arg_cache->is_caller_allocates);
- } else if (iface_cache->is_foreign) {
- PyObject *success;
- success = pygi_struct_foreign_convert_to_g_argument (py_arg,
- iface_cache->interface_info,
- arg_cache->transfer,
- arg);
-
- return (success == Py_None);
- } else if (!PyObject_IsInstance (py_arg, iface_cache->py_type)) {
- /* first check to see if this is a member of the expected union */
- if (!_is_union_member (iface_cache, py_arg)) {
- if (!PyErr_Occurred()) {
- PyObject *module = PyObject_GetAttrString(py_arg, "__module__");
-
- PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s",
- arg_cache->arg_name ? arg_cache->arg_name : "self",
- iface_cache->type_name,
- module ? PYGLIB_PyUnicode_AsString(module) : "",
- module ? "." : "",
- py_arg->ob_type->tp_name);
- if (module)
- Py_DECREF (module);
- }
-
- return FALSE;
- }
- }
-
- if (g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) {
- arg->v_pointer = pyg_boxed_get (py_arg, void);
- if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) {
- arg->v_pointer = g_boxed_copy (iface_cache->g_type, arg->v_pointer);
- }
- } else if (g_type_is_a (iface_cache->g_type, G_TYPE_POINTER) ||
- g_type_is_a (iface_cache->g_type, G_TYPE_VARIANT) ||
- iface_cache->g_type == G_TYPE_NONE) {
- arg->v_pointer = pyg_pointer_get (py_arg, void);
- } else {
- PyErr_Format (PyExc_NotImplementedError,
- "structure type '%s' is not supported yet",
- g_type_name(iface_cache->g_type));
- return FALSE;
- }
- return TRUE;
+ return pygi_marshal_from_py_interface_struct (py_arg,
+ arg,
+ arg_cache->arg_name,
+ iface_cache->interface_info,
+ arg_cache->type_info,
+ iface_cache->g_type,
+ iface_cache->py_type,
+ arg_cache->transfer,
+ arg_cache->is_caller_allocates,
+ iface_cache->is_foreign);
}
gboolean
if (!PyObject_IsInstance (py_arg, iface_cache->py_type)) {
/* wait, we might be a member of a union so manually check */
- if (!_is_union_member (iface_cache, py_arg)) {
+ if (!_is_union_member (iface_cache->interface_info, py_arg)) {
if (!PyErr_Occurred()) {
PyObject *module = PyObject_GetAttrString(py_arg, "__module__");
PyErr_Format (PyExc_TypeError,
arg->v_pointer = closure;
return TRUE;
}
+
+gboolean
+pygi_marshal_from_py_interface_struct (PyObject *py_arg,
+ GIArgument *arg,
+ const gchar *arg_name,
+ GIBaseInfo *interface_info,
+ GITypeInfo *type_info,
+ GType g_type,
+ PyObject *py_type,
+ GITransfer transfer,
+ gboolean is_allocated,
+ gboolean is_foreign)
+{
+ if (py_arg == Py_None) {
+ arg->v_pointer = NULL;
+ return TRUE;
+ }
+
+ /* FIXME: handle this large if statement in the cache
+ * and set the correct marshaller
+ */
+
+ if (g_type_is_a (g_type, G_TYPE_CLOSURE)) {
+ return pygi_marshal_from_py_gclosure (py_arg, arg);
+ } else if (g_type_is_a (g_type, G_TYPE_VALUE)) {
+ return pygi_marshal_from_py_gvalue(py_arg,
+ arg,
+ transfer,
+ is_allocated);
+ } else if (is_foreign) {
+ PyObject *success;
+ success = pygi_struct_foreign_convert_to_g_argument (py_arg,
+ interface_info,
+ transfer,
+ arg);
+
+ return (success == Py_None);
+ } else if (!PyObject_IsInstance (py_arg, py_type)) {
+ /* first check to see if this is a member of the expected union */
+ if (!_is_union_member (interface_info, py_arg)) {
+ if (!PyErr_Occurred()) {
+ gchar *type_name = _pygi_g_base_info_get_fullname (interface_info);
+ PyObject *module = PyObject_GetAttrString(py_arg, "__module__");
+
+ PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s",
+ arg_name ? arg_name : "self",
+ type_name,
+ module ? PYGLIB_PyUnicode_AsString(module) : "",
+ module ? "." : "",
+ py_arg->ob_type->tp_name);
+ if (module)
+ Py_DECREF (module);
+ g_free (type_name);
+ }
+
+ return FALSE;
+ }
+ }
+
+ if (g_type_is_a (g_type, G_TYPE_BOXED)) {
+ if (pyg_boxed_check (py_arg, g_type)) {
+ arg->v_pointer = pyg_boxed_get (py_arg, void);
+ if (transfer == GI_TRANSFER_EVERYTHING) {
+ arg->v_pointer = g_boxed_copy (g_type, arg->v_pointer);
+ }
+ } else {
+ PyErr_Format (PyExc_TypeError, "wrong boxed type");
+ return FALSE;
+ }
+
+ } else if (g_type_is_a (g_type, G_TYPE_POINTER) ||
+ g_type_is_a (g_type, G_TYPE_VARIANT) ||
+ g_type == G_TYPE_NONE) {
+ g_warn_if_fail (g_type_is_a (g_type, G_TYPE_VARIANT) || !g_type_info_is_pointer (type_info) || transfer == GI_TRANSFER_NOTHING);
+
+ if (g_type_is_a (g_type, G_TYPE_VARIANT) &&
+ pyg_type_from_object (py_arg) != G_TYPE_VARIANT) {
+ PyErr_SetString (PyExc_TypeError, "expected GLib.Variant");
+ return FALSE;
+ }
+ arg->v_pointer = pyg_pointer_get (py_arg, void);
+
+ } else {
+ PyErr_Format (PyExc_NotImplementedError,
+ "structure type '%s' is not supported yet",
+ g_type_name(g_type));
+ return FALSE;
+ }
+ return TRUE;
+}
gboolean pygi_marshal_from_py_gclosure(PyObject *py_arg, /*in*/
GIArgument *arg); /*out*/
+gboolean pygi_marshal_from_py_interface_struct (PyObject *py_arg,
+ GIArgument *arg,
+ const gchar *arg_name,
+ GIBaseInfo *interface_info,
+ GITypeInfo *type_info,
+ GType g_type,
+ PyObject *py_type,
+ GITransfer transfer,
+ gboolean is_allocated,
+ gboolean is_foreign);
+
G_END_DECLS
#endif /* __PYGI_MARSHAL_from_py_PY__ */
{
PyObject *py_obj = NULL;
if (arg->v_string == NULL) {
- py_obj = Py_None;
- Py_INCREF (py_obj);
- return py_obj;
+ Py_RETURN_NONE;
}
py_obj = PYGLIB_PyUnicode_FromString (arg->v_string);
PyGIArgCache *arg_cache,
GIArgument *arg)
{
- gchar *string;
+ gchar *string = NULL;
PyObject *py_obj = NULL;
GError *error = NULL;
if (arg->v_string == NULL) {
- py_obj = Py_None;
- Py_INCREF (py_obj);
- return py_obj;
+ Py_RETURN_NONE;
}
string = g_filename_to_utf8 (arg->v_string, -1, NULL, NULL, &error);
PyGIArgCache *arg_cache,
GIArgument *arg)
{
- PyObject *py_obj = NULL;
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
- GType type = iface_cache->g_type;
-
- if (arg->v_pointer == NULL) {
- py_obj = Py_None;
- Py_INCREF (py_obj);
- return py_obj;
- }
-
- if (g_type_is_a (type, G_TYPE_VALUE)) {
- py_obj = pyg_value_as_pyobject (arg->v_pointer, FALSE);
- } else if (iface_cache->is_foreign) {
- py_obj = pygi_struct_foreign_convert_from_g_argument (iface_cache->interface_info,
- arg->v_pointer);
- } else if (g_type_is_a (type, G_TYPE_BOXED)) {
- py_obj = _pygi_boxed_new ( (PyTypeObject *)iface_cache->py_type, arg->v_pointer,
- arg_cache->transfer == GI_TRANSFER_EVERYTHING || arg_cache->is_caller_allocates,
- arg_cache->is_caller_allocates ?
- g_struct_info_get_size(iface_cache->interface_info) : 0);
- } else if (g_type_is_a (type, G_TYPE_POINTER)) {
- if (iface_cache->py_type == NULL ||
- !PyType_IsSubtype ( (PyTypeObject *)iface_cache->py_type, &PyGIStruct_Type)) {
- g_warn_if_fail(arg_cache->transfer == GI_TRANSFER_NOTHING);
- py_obj = pyg_pointer_new (type, arg->v_pointer);
- } else {
- py_obj = _pygi_struct_new ( (PyTypeObject *)iface_cache->py_type, arg->v_pointer,
- arg_cache->transfer == GI_TRANSFER_EVERYTHING);
- }
- } else if (g_type_is_a (type, G_TYPE_VARIANT)) {
- g_variant_ref_sink (arg->v_pointer);
- py_obj = _pygi_struct_new ( (PyTypeObject *)iface_cache->py_type, arg->v_pointer,
- FALSE);
- } else if (type == G_TYPE_NONE && iface_cache->is_foreign) {
- py_obj = pygi_struct_foreign_convert_from_g_argument (iface_cache->interface_info, arg->v_pointer);
- } else if (type == G_TYPE_NONE) {
- py_obj = _pygi_struct_new ( (PyTypeObject *) iface_cache->py_type, arg->v_pointer,
- arg_cache->transfer == GI_TRANSFER_EVERYTHING);
- } else {
- PyErr_Format (PyExc_NotImplementedError,
- "structure type '%s' is not supported yet",
- g_type_name (type));
- }
- return py_obj;
+ return pygi_marshal_to_py_interface_struct (arg,
+ iface_cache->interface_info,
+ iface_cache->g_type,
+ iface_cache->py_type,
+ arg_cache->transfer,
+ arg_cache->is_caller_allocates,
+ iface_cache->is_foreign);
}
PyObject *
return pyobj;
}
+
+PyObject *
+pygi_marshal_to_py_interface_struct (GIArgument *arg,
+ GIInterfaceInfo *interface_info,
+ GType g_type,
+ PyObject *py_type,
+ GITransfer transfer,
+ gboolean is_allocated,
+ gboolean is_foreign)
+{
+ PyObject *py_obj = NULL;
+
+ if (arg->v_pointer == NULL) {
+ Py_RETURN_NONE;
+ }
+
+ if (g_type_is_a (g_type, G_TYPE_VALUE)) {
+ py_obj = pyg_value_as_pyobject (arg->v_pointer, FALSE);
+ } else if (is_foreign) {
+ py_obj = pygi_struct_foreign_convert_from_g_argument (interface_info,
+ arg->v_pointer);
+ } else if (g_type_is_a (g_type, G_TYPE_BOXED)) {
+ if (py_type) {
+ py_obj = _pygi_boxed_new ((PyTypeObject *) py_type,
+ arg->v_pointer,
+ transfer == GI_TRANSFER_EVERYTHING || is_allocated,
+ is_allocated ?
+ g_struct_info_get_size(interface_info) : 0);
+ }
+ } else if (g_type_is_a (g_type, G_TYPE_POINTER)) {
+ if (py_type == NULL ||
+ !PyType_IsSubtype ((PyTypeObject *) py_type, &PyGIStruct_Type)) {
+ g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
+ py_obj = pyg_pointer_new (g_type, arg->v_pointer);
+ } else {
+ py_obj = _pygi_struct_new ( (PyTypeObject *) py_type,
+ arg->v_pointer,
+ transfer == GI_TRANSFER_EVERYTHING);
+ }
+ } else if (g_type_is_a (g_type, G_TYPE_VARIANT)) {
+ /* Note we do not use transfer for the structs free_on_dealloc because
+ * GLib.Variant overrides __del__ to call "g_variant_unref". */
+ if (py_type) {
+ g_variant_ref_sink (arg->v_pointer);
+ py_obj = _pygi_struct_new ((PyTypeObject *) py_type,
+ arg->v_pointer,
+ FALSE);
+ }
+ } else if (g_type == G_TYPE_NONE) {
+ if (py_type) {
+ py_obj = _pygi_struct_new ((PyTypeObject *) py_type,
+ arg->v_pointer,
+ transfer == GI_TRANSFER_EVERYTHING);
+ }
+ } else {
+ PyErr_Format (PyExc_NotImplementedError,
+ "structure type '%s' is not supported yet",
+ g_type_name (g_type));
+ }
+
+ return py_obj;
+}
PyObject *pygi_marshal_to_py_object (GIArgument *arg,
GITransfer transfer);
+PyObject *pygi_marshal_to_py_interface_struct (GIArgument *arg,
+ GIInterfaceInfo *interface_info,
+ GType g_type,
+ PyObject *py_type,
+ GITransfer transfer,
+ gboolean is_allocated,
+ gboolean is_foreign);
+
G_END_DECLS
#endif /* __PYGI_MARSHAL_TO_PY_H__ */
switch (info_type) {
case GI_INFO_TYPE_ENUM:
- arg.v_int32 = g_value_get_enum (&value);
+ arg.v_int = g_value_get_enum (&value);
break;
case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_OBJECT:
switch (info_type) {
case GI_INFO_TYPE_ENUM:
- g_value_set_enum (&value, arg.v_int32);
+ g_value_set_enum (&value, arg.v_int);
break;
case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_OBJECT:
PyErr_Format (PyExc_NotImplementedError,
"Setting properties of type '%s' is not implemented",
g_type_name (type));
+ goto out;
}
- goto out;
+ break;
default:
PyErr_Format (PyExc_NotImplementedError,
"Setting properties of type '%s' is not implemented",
const char *name;
GIBaseInfo *info;
PyObject *py_info;
+ size_t len;
+ char *trimmed_name = NULL;
if (!PyArg_ParseTupleAndKeywords (args, kwargs,
"ss:Repository.find_by_name", kwlist, &namespace_, &name)) {
return NULL;
}
+ /* If the given name ends with an underscore, it might be due to usage
+ * as an accessible replacement for something in GI with the same name
+ * as a Python keyword. Test for this and trim it out if necessary.
+ */
+ len = strlen (name);
+ if (len > 0 && name[len-1] == '_') {
+ trimmed_name = g_strndup (name, len-1);
+ if (_pygi_is_python_keyword (trimmed_name)) {
+ name = trimmed_name;
+ }
+ }
+
info = g_irepository_find_by_name (self->repository, namespace_, name);
+ g_free (trimmed_name);
+
if (info == NULL) {
Py_RETURN_NONE;
}
#include "pygi-private.h"
-/* Copied from glib */
-static void
-canonicalize_key (gchar *key)
-{
- gchar *p;
-
- for (p = key; *p != 0; p++)
- {
- gchar c = *p;
-
- if (c != '-' &&
- (c < '0' || c > '9') &&
- (c < 'A' || c > 'Z') &&
- (c < 'a' || c > 'z'))
- *p = '-';
- }
-}
-
static GISignalInfo *
_pygi_lookup_signal_from_g_type (GType g_type,
const gchar *signal_name)
{
GIRepository *repository;
GIBaseInfo *info;
- GType parent;
+ GISignalInfo *signal_info = NULL;
repository = g_irepository_get_default();
info = g_irepository_find_by_gtype (repository, g_type);
- if (info != NULL) {
- GISignalInfo *signal_info;
- signal_info = g_object_info_find_signal ((GIObjectInfo *) info, signal_name);
- g_base_info_unref (info);
- if (signal_info != NULL)
- return signal_info;
- }
-
- parent = g_type_parent (g_type);
- if (parent > 0)
- return _pygi_lookup_signal_from_g_type (parent, signal_name);
-
- return NULL;
+ if (info == NULL)
+ return NULL;
+
+ if (GI_IS_OBJECT_INFO (info))
+ signal_info = g_object_info_find_signal ((GIObjectInfo *) info,
+ signal_name);
+ else if (GI_IS_INTERFACE_INFO (info))
+ signal_info = g_interface_info_find_signal ((GIInterfaceInfo *) info,
+ signal_name);
+
+ g_base_info_unref (info);
+ return signal_info;
}
static void
GClosure *
pygi_signal_closure_new_real (PyGObject *instance,
- const gchar *sig_name,
+ GType g_type,
+ const gchar *signal_name,
PyObject *callback,
PyObject *extra_args,
PyObject *swap_data)
{
GClosure *closure = NULL;
PyGISignalClosure *pygi_closure = NULL;
- GType g_type;
GISignalInfo *signal_info = NULL;
- char *signal_name = g_strdup (sig_name);
g_return_val_if_fail(callback != NULL, NULL);
- canonicalize_key(signal_name);
-
- g_type = pyg_type_from_object ((PyObject *)instance);
signal_info = _pygi_lookup_signal_from_g_type (g_type, signal_name);
-
if (signal_info == NULL)
- goto out;
+ return NULL;
closure = g_closure_new_simple(sizeof(PyGISignalClosure), NULL);
g_closure_add_invalidate_notifier(closure, NULL, pygi_signal_closure_invalidate);
closure->derivative_flag = TRUE;
}
-out:
- g_free (signal_name);
-
return closure;
}
} PyGISignalClosure;
GClosure * pygi_signal_closure_new_real (PyGObject *instance,
+ GType g_type,
const gchar *sig_name,
PyObject *callback,
PyObject *extra_args,
GParamSpec *pspec,
PyObject *value);
GClosure * (*signal_closure_new) (PyGObject *instance,
+ GType g_type,
const gchar *sig_name,
PyObject *callback,
PyObject *extra_args,
if (PyGI_API != NULL) {
return 1;
}
-#if PY_VERSION_HEX >= 0x03000000
PyGI_API = (struct PyGI_API*) PyCapsule_Import("gi._API", FALSE);
-#else
- PyGI_API = (struct PyGI_API*) PyCObject_Import("gi", "_API");
-#endif
if (PyGI_API == NULL) {
return -1;
}
static inline GClosure *
pygi_signal_closure_new (PyGObject *instance,
+ GType g_type,
const gchar *sig_name,
PyObject *callback,
PyObject *extra_args,
if (_pygi_import() < 0) {
return NULL;
}
- return PyGI_API->signal_closure_new(instance, sig_name, callback, extra_args, swap_data);
+ return PyGI_API->signal_closure_new(instance, g_type, sig_name, callback, extra_args, swap_data);
}
static inline PyObject *
PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
if test -x "$PYTHON_CONFIG"; then
PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null`
else
- 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_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
- if test "$py_prefix" != "$py_exec_prefix"; then
- PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
- fi
+ PYTHON_INCLUDES=`$PYTHON -c "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc(True))"`
+ PYTHON_INCLUDES="-I$PYTHON_INCLUDES"
fi
fi
AC_SUBST(PYTHON_INCLUDES)
dnl AM_CHECK_PYTHON_LIBS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
dnl function also defines PYTHON_LIBS
AC_DEFUN([AM_CHECK_PYTHON_LIBS],
-[AC_REQUIRE([AM_CHECK_PYTHON_HEADERS])
+[AC_REQUIRE([AM_PATH_PYTHON])
AC_MSG_CHECKING(for libraries required to embed python)
dnl deduce PYTHON_LIBS
-py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
+py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
if test "x$PYTHON_LIBS" = x; then
PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}"
fi
dnl Find a Python interpreter. Python versions prior to 2.0 are not
dnl supported
m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
- [python3 python3.3 python3.2 python3.1 python2 python2.7 python2.6 python])
+ [python3 python3.3 python3.2 python3.1 python2 python2.7 python])
m4_if([$1],[],[
dnl No version check is needed.
\
-pe "s/import pygtk/import gi/g;" \
-pe "s/pygtk.require\('2.0'\)/gi.require_version\('Gtk', '3.0'\)/g;" \
+ -pe "s/pygtk.require\(\"2.0\"\)/gi.require_version\(\"Gtk\", \"3.0\"\)/g;" \
-pe "s/import gtk\n/from gi.repository import Gtk\n/g;" \
-pe "s/(?<!\.)gtk\./Gtk\./g;" \
-pe "s/Gtk.ACCEL_/Gtk.AccelFlags./g;" \
-pe "s/Gtk.ORIENTATION_/Gtk.Orientation./g;" \
-pe "s/Gtk.POLICY_/Gtk.PolicyType./g;" \
-pe "s/Gtk.POS_/Gtk.PositionType./g;" \
+ -pe "s/Gtk.RECENT_FILTER_/Gtk.RecentFilterFlags./g;" \
+ -pe "s/Gtk.RECENT_SORT_/Gtk.RecentSortType./g;" \
-pe "s/Gtk.RELIEF_/Gtk.ReliefStyle./g;" \
-pe "s/Gtk.RESPONSE_/Gtk.ResponseType./g;" \
-pe "s/Gtk.SELECTION_/Gtk.SelectionMode./g;" \
-pe "s/Gtk.TEXT_DIR_/Gtk.TextDirection./g;" \
-pe "s/Gtk.TEXT_SEARCH_/Gtk.TextSearchFlags./g;" \
-pe "s/Gtk.TEXT_WINDOW_/Gtk.TextWindowType./g;" \
+ -pe "s/Gtk.TOOLBAR_/Gtk.ToolbarStyle./g;" \
+ -pe "s/Gtk.TREE_MODEL_/Gtk.TreeModelFlags./g;" \
-pe "s/Gtk.TREE_VIEW_COLUMN_/Gtk.TreeViewColumnSizing./g;" \
-pe "s/Gtk.TREE_VIEW_DROP_/Gtk.TreeViewDropPosition./g;" \
-pe "s/Gtk.TRUE/True/g;" \
-pe "s/Gtk.accel_map_/Gtk.AccelMap./g;" \
-pe "s/Gtk.settings_get_/Gtk.Settings.get_/g;" \
-pe "s/Gtk.icon_theme_get_default/Gtk.IconTheme.get_default/g;" \
+ -pe "s/Gtk.recent_manager_get_default/Gtk.RecentManager.get_default/g;" \
-pe "s/Gtk.image_new_from_stock/Gtk.Image.new_from_stock/g;" \
-pe "s/Gtk.image_new_from_icon_name/Gtk.Image.new_from_icon_name/g;" \
-pe "s/Gtk.window_set_default_icon_name/Gtk.Window.set_default_icon_name/g; " \
-pe "s/Gtk.combo_box_new_text/Gtk.ComboBoxText/g;" \
- -pe "s/Gtk.keysyms./Gdk.KEY_/g;" \
+ -pe "s/Gtk.keysyms\./Gdk.KEY_/g;" \
-pe "s/set_flags\(Gtk.CAN_DEFAULT\)/set_can_default\(True\)/g;" \
-pe "s/.flags\(\) & Gtk.MAPPED/.get_mapped\(\)/g;" \
-pe "s/.flags\(\) & Gtk.REALIZED/.get_realized\(\)/g;" \
\
-pe "s/import gio\n/from gi.repository import Gio\n/g;" \
-pe "s/gio\./Gio\./g;" \
+ -pe "s/Gio\.File\(uri=/Gio\.File\.new_for_uri\(/g;" \
+ -pe "s/Gio\.File\(path=/Gio\.File\.new_for_path\(/g;" \
-pe "s/Gio.FILE_COPY_/Gio.FileCopyFlags./g;" \
-pe "s/Gio.FILE_CREATE_/Gio.FileCreateFlags./g;" \
-pe "s/Gio.FILE_MONITOR_EVENT_/Gio.FileMonitorEvent./g;" \
-pe "s/Clutter.RELEASE_MASK/Clutter.ModifierType.RELEASE_MASK/g;" \
-pe "s/Clutter.SHIFT_MASK/Clutter.ModifierType.SHIFT_MASK/g;" \
-pe "s/Clutter.SUPER_MASK/Clutter.ModifierType.SUPER_MASK/g;" \
+\
+ -pe "s/import gst\n/from gi.repository import Gst\n/g;" \
+ -pe "s/(?<!\.)gst\./Gst\./g;" \
+ -pe "s/Gst.element_factory_find/Gst.ElementFactory.find/g;" \
+ -pe "s/Gst.element_factory_make/Gst.ElementFactory.make/g;" \
+ -pe "s/Gst.caps_from_string/Gst.Caps.from_string/g;" \
+ -pe "s/Gst.STATE_CHANGE_/Gst.StateChangeReturn./g;" \
+ -pe "s/Gst.STATE_/Gst.State./g;" \
+ -pe "s/Gst.MESSAGE_/Gst.MessageType./g;" \
+ -pe "s/Gst.FORMAT_/Gst.Format./g;" \
+ -pe "s/Gst.SEEK_FLAG_/Gst.SeekFlags./g;" \
+ -pe "s/Gst.SEEK_TYPE_/Gst.SeekType./g;" \
+ -pe "s/Gst.LEVEL_/Gst.DebugLevel./g;" \
+ -pe "s/Gst.URI_/Gst.URIType./g;" \
+ -pe "s/Gst.element_make_from_uri/Gst.Element.make_from_uri/g;" \
+ -pe "s/Gst.event_new_seek/Gst.Event.new_seek/g;" \
+ -pe "s/Gst.GhostPad\(/Gst.GhostPad.new\(/g;" \
$f
done
PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
CLEANFILES =
-noinst_LTLIBRARIES = libgimarshallingtests.la
+check_LTLIBRARIES = libgimarshallingtests.la
test_typelibs = GIMarshallingTests-1.0.typelib
nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
# regress.c needs cairo
if ENABLE_CAIRO
-noinst_LTLIBRARIES += libregress.la
+check_LTLIBRARIES += libregress.la
test_typelibs += Regress-1.0.typelib
nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
CLEANFILES += Regress-1.0.gir Regress-1.0.typelib GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib gschemas.compiled
-noinst_LTLIBRARIES += testhelper.la
+check_LTLIBRARIES += testhelper.la
testhelper_la_CFLAGS = -I$(top_srcdir)/gi/_gobject -I$(top_srcdir)/gi/_glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
testhelper_la_LDFLAGS = -module -avoid-version
test -L $@ || $(LN_S) .libs/$@ $@
-all: $(LTLIBRARIES:.la=.so)
+all: $(check_LTLIBRARIES:.la=.so)
EXTRA_DIST = \
compathelper.py \
$(NULL)
clean-local:
- rm -f $(LTLIBRARIES:.la=.so) file.txt~
+ rm -f $(check_LTLIBRARIES:.la=.so) file.txt~
DBUS_LAUNCH=$(shell which dbus-launch)
RUN_TESTS_ENV_VARS= \
# pygtkcompat tests need to be run in a separate process as they
# clobber global name space
-check-local: $(LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled
+check-local: $(check_LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled
@echo " CHECK Pyflakes"
@if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi
@if test -z "$$SKIP_PEP8"; then \
# PARTICULAR PURPOSE.
@SET_MAKE@
-
VPATH = @srcdir@
am__make_dryrun = \
{ \
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
libgimarshallingtests_la_LIBADD =
nodist_libgimarshallingtests_la_OBJECTS = \
libgimarshallingtests_la-gimarshallingtests.lo
PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
CLEANFILES = Regress-1.0.gir Regress-1.0.typelib \
GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib \
gschemas.compiled
-noinst_LTLIBRARIES = libgimarshallingtests.la $(am__append_1) \
+check_LTLIBRARIES = libgimarshallingtests.la $(am__append_1) \
testhelper.la
test_typelibs = GIMarshallingTests-1.0.typelib $(am__append_2)
nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+clean-checkLTLIBRARIES:
+ -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES)
+ @list='$(check_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
fi; \
done
check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES)
$(MAKE) $(AM_MAKEFLAGS) check-local
check: check-am
-all-am: Makefile $(LTLIBRARIES)
+all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-local \
- clean-noinstLTLIBRARIES mostlyclean-am
+clean-am: clean-checkLTLIBRARIES clean-generic clean-libtool \
+ clean-local mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
- clean-generic clean-libtool clean-local \
- clean-noinstLTLIBRARIES ctags distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
+ clean-checkLTLIBRARIES clean-generic clean-libtool clean-local \
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am
.la.so:
test -L $@ || $(LN_S) .libs/$@ $@
-all: $(LTLIBRARIES:.la=.so)
+all: $(check_LTLIBRARIES:.la=.so)
clean-local:
- rm -f $(LTLIBRARIES:.la=.so) file.txt~
+ rm -f $(check_LTLIBRARIES:.la=.so) file.txt~
# pygtkcompat tests need to be run in a separate process as they
# clobber global name space
-check-local: $(LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled
+check-local: $(check_LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled
@echo " CHECK Pyflakes"
@if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi
@if test -z "$$SKIP_PEP8"; then \
import unittest
-# provide missing unittest decorators and API for python 2.6; these decorators
-# do not actually work, just avoid the syntax failure
-if sys.version_info[:2] == (2, 6):
- def skipUnless(condition, reason):
- if not condition:
- sys.stderr.write('[expected failure] ')
- return lambda obj: obj
-
- unittest.skipUnless = skipUnless
- unittest.expectedFailure = lambda obj: obj
-
- def skipIf(condition, reason):
- if condition:
- sys.stderr.write('[expected failure] ')
- return lambda obj: obj
-
- unittest.skipIf = skipIf
-
- def assertGreater(self, a, b, msg=None):
- if not a > b:
- self.fail('%s not greater than %s' % (repr(a), repr(b)))
-
- def assertGreaterEqual(self, a, b, msg=None):
- if not a >= b:
- self.fail('%s not greater than or equal to %s' % (repr(a), repr(b)))
-
- def assertLess(self, a, b, msg=None):
- if not a < b:
- self.fail('%s not less than %s' % (repr(a), repr(b)))
-
- def assertLessEqual(self, a, b, msg=None):
- if not a <= b:
- self.fail('%s not less than or equal to %s' % (repr(a), repr(b)))
-
- def assertIsInstance(self, obj, cls, msg=None):
- if not isinstance(obj, cls):
- self.fail('%s is not an instance of %r' % (repr(obj), cls))
-
- unittest.TestCase.assertGreaterEqual = assertGreaterEqual
- unittest.TestCase.assertGreater = assertGreater
- unittest.TestCase.assertLessEqual = assertLessEqual
- unittest.TestCase.assertLess = assertLess
- unittest.TestCase.assertIsInstance = assertIsInstance
-
+# this was renamed in Python 3, provide backwards compatible name
if sys.version_info[:2] == (2, 7):
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
glist = GLib.List()
raw = RawGList.from_wrapped(glist)
- self.assertEqual(glist.data, None)
+ # Note that pointer fields use 0 for NULL in PyGObject and None in ctypes
+ self.assertEqual(glist.data, 0)
self.assertEqual(raw.contents.data, None)
glist.data = 123
self.assertEqual(raw.contents.data, 123)
glist.data = None
- self.assertEqual(glist.data, None)
+ self.assertEqual(glist.data, 0)
self.assertEqual(raw.contents.data, None)
# Setting to anything other than an int should raise
obj.emit_sig_with_obj()
self.assertTrue(obj.called)
+ def test_connect_after(self):
+ obj = Everything.TestObj()
+
+ def callback(obj, obj_param):
+ obj.called = True
+
+ obj.called = False
+ obj.connect_after('sig-with-obj', callback)
+ obj.emit_sig_with_obj()
+ self.assertTrue(obj.called)
+
+ def test_connect_object(self):
+ obj = Everything.TestObj()
+
+ def callback(obj, obj_param):
+ obj.called = True
+
+ obj.called = False
+ obj.connect_object('sig-with-obj', callback, obj)
+ obj.emit_sig_with_obj()
+ self.assertTrue(obj.called)
+
+ def test_connect_object_after(self):
+ obj = Everything.TestObj()
+
+ def callback(obj, obj_param):
+ obj.called = True
+
+ obj.called = False
+ obj.connect_object_after('sig-with-obj', callback, obj)
+ obj.emit_sig_with_obj()
+ self.assertTrue(obj.called)
+
def test_int64_param_from_py(self):
obj = Everything.TestObj()
GIMarshallingTests.array_struct_in([struct1, struct2, struct3])
- @unittest.skipUnless(hasattr(GIMarshallingTests, 'array_struct_value_in'),
- 'too old gobject-introspection')
def test_array_boxed_struct_value_in(self):
struct1 = GIMarshallingTests.BoxedStruct()
struct1.long_ = 1
def test_garray_utf8_full_out(self):
self.assertEqual(['0', '1', '2'], GIMarshallingTests.garray_utf8_full_out())
- @unittest.skipUnless(hasattr(GIMarshallingTests, 'garray_utf8_full_out_caller_allocated'),
- 'too old gobject-introspection')
def test_garray_utf8_full_out_caller_allocated(self):
self.assertEqual(['0', '1', '2'], GIMarshallingTests.garray_utf8_full_out_caller_allocated())
self.assertEqual(3, b.get_size())
self.assertEqual(b'\x00\x01\xFF', b.get_data())
- @unittest.skipUnless(hasattr(GIMarshallingTests, 'gbytes_full_return'),
- 'too old gobject-introspection')
def test_gbytes_full_return(self):
b = GIMarshallingTests.gbytes_full_return()
self.assertEqual(4, b.get_size())
self.assertEqual(b'\x00\x31\xFF\x33', b.get_data())
- @unittest.skipUnless(hasattr(GIMarshallingTests, 'gbytes_full_return'),
- 'too old gobject-introspection')
def test_gbytes_none_in(self):
b = GIMarshallingTests.gbytes_full_return()
GIMarshallingTests.gbytes_none_in(b)
GIMarshallingTests.NoTypeFlags.__gtype__)
-@unittest.skipUnless(hasattr(GIMarshallingTests.Object, 'vfunc_return_enum'),
- 'GIMarshallingTests too old')
class TestEnumVFuncResults(unittest.TestCase):
class EnumTester(GIMarshallingTests.Object):
def do_vfunc_return_enum(self):
del struct
- @unittest.skipUnless(hasattr(GIMarshallingTests.BoxedStruct, 'string_'),
- 'too old gobject-introspection')
def test_boxed_struct(self):
self.assertTrue(issubclass(GIMarshallingTests.BoxedStruct, GObject.GBoxed))
del struct
- @unittest.skipUnless(hasattr(GIMarshallingTests.BoxedStruct, 'string_'),
- 'too old gobject-introspection')
def test_boxed_struct_new(self):
struct = GIMarshallingTests.BoxedStruct.new()
self.assertTrue(isinstance(struct, GIMarshallingTests.BoxedStruct))
del struct
- @unittest.skipUnless(hasattr(GIMarshallingTests.BoxedStruct, 'string_'),
- 'too old gobject-introspection')
def test_boxed_struct_copy(self):
struct = GIMarshallingTests.BoxedStruct()
struct.long_ = 42
del new_struct
del struct
- @unittest.skipUnless(hasattr(GIMarshallingTests.BoxedStruct, 'string_'),
- 'too old gobject-introspection')
def test_boxed_struct_return(self):
struct = GIMarshallingTests.boxed_struct_returnv()
class TestParamSpec(unittest.TestCase):
# https://bugzilla.gnome.org/show_bug.cgi?id=682355
- @unittest.skipUnless(hasattr(GIMarshallingTests, 'param_spec_in_bool'),
- 'too old gobject-introspection')
@unittest.expectedFailure
def test_param_spec_in_bool(self):
ps = GObject.param_spec_boolean('mybool', 'test-bool', 'boolblurb',
obj = GIMarshallingTests.PropertiesObject(some_boxed_struct=struct1)
self.assertEqual(obj.props.some_boxed_struct.long_, 1)
- @unittest.skipUnless(hasattr(GIMarshallingTests.PropertiesObject, 'some_boxed_glist'),
- 'too old gobject-introspection')
def test_boxed_glist(self):
self.assertEqual(self.obj.props.some_boxed_glist, [])
obj = GIMarshallingTests.PropertiesObject(some_boxed_glist=l)
self.assertEqual(obj.props.some_boxed_glist, l)
- @unittest.skipUnless(hasattr(GIMarshallingTests.PropertiesObject, 'some_variant'),
- 'too old gobject-introspection')
def test_variant(self):
self.assertEqual(self.obj.props.some_variant, None)
info = repo.find_by_name('GObject', 'Object')
self.assertFalse(info.get_abstract())
+ def test_get_class_struct(self):
+ self.assertEqual(GObject.Object.__info__.get_class_struct(),
+ GObject.ObjectClass.__info__)
+
class TestSignatureArgs(unittest.TestCase):
def test_split_args_multi_out(self):
# The pytype wrapper should hold the outer most Object class from overrides.
self.assertEqual(GObject.TYPE_OBJECT.pytype, GObject.Object)
- @unittest.skipIf(sys.version_info[:2] < (2, 7), 'Python 2.7 is required')
def test_gobject_unsupported_overrides(self):
obj = GObject.Object()
self.in_object_is_floating = obj.is_floating()
-@unittest.skipUnless(hasattr(VFuncsBase, 'get_ref_info_for_vfunc_return_object_transfer_none') and
- hasattr(VFuncsBase, 'get_ref_info_for_vfunc_out_object_transfer_none'),
- 'too old gobject-introspection')
class TestVFuncsWithObjectArg(unittest.TestCase):
# Basic set of tests which work on non-floating objects which python does
# not keep an additional reference of.
self.assertTrue(vfuncs.object_ref() is None)
-@unittest.skipUnless(hasattr(VFuncsBase, 'get_ref_info_for_vfunc_return_object_transfer_none') and
- hasattr(VFuncsBase, 'get_ref_info_for_vfunc_out_object_transfer_none'),
- 'too old gobject-introspection')
class TestVFuncsWithFloatingArg(unittest.TestCase):
# All tests here work with a floating object by using InitiallyUnowned as the argument
self.assertTrue(vfuncs.object_ref() is None)
-@unittest.skipUnless(hasattr(VFuncsBase, 'get_ref_info_for_vfunc_return_object_transfer_none') and
- hasattr(VFuncsBase, 'get_ref_info_for_vfunc_out_object_transfer_none'),
- 'too old gobject-introspection')
class TestVFuncsWithHeldObjectArg(unittest.TestCase):
# Same tests as TestVFuncsWithObjectArg except we hold
# onto the python object reference in all cases.
self.assertTrue(held_object_ref() is None)
-@unittest.skipUnless(hasattr(VFuncsBase, 'get_ref_info_for_vfunc_return_object_transfer_none') and
- hasattr(VFuncsBase, 'get_ref_info_for_vfunc_out_object_transfer_none'),
- 'too old gobject-introspection')
class TestVFuncsWithHeldFloatingArg(unittest.TestCase):
# Tests for a floating object which we hold a reference to the python wrapper
# on the VFuncs test class.
self.assertTrue(held_object_ref() is None)
-@unittest.skipUnless(hasattr(GIMarshallingTests.PropertiesObject.props, 'some_object'),
- 'too old gobject-introspection')
class TestPropertyHoldingObject(unittest.TestCase):
def test_props_getter_holding_object_ref_count(self):
holder = GIMarshallingTests.PropertiesObject()
layout.set_markup("Foobar")
self.assertEqual(layout.get_text(), "Foobar")
+
+ def test_break_keyword_escape(self):
+ # https://bugzilla.gnome.org/show_bug.cgi?id=697363
+ self.assertTrue(hasattr(Pango, 'break_'))
+ self.assertTrue(Pango.break_ is not None)
class TestSignalModuleLevelFunctions(unittest.TestCase):
- @unittest.skipIf(sys.version_info < (2, 7), 'Requires Python >= 2.7')
def test_signal_list_ids_with_invalid_type(self):
with self.assertRaisesRegex(TypeError, 'type must be instantiable or an interface.*'):
GObject.signal_list_ids(GObject.TYPE_INVALID)
- @unittest.skipIf(sys.version_info < (2, 7), 'Requires Python >= 2.7')
def test_signal_list_ids(self):
with self.assertRaisesRegex(TypeError, 'type must be instantiable or an interface.*'):
GObject.signal_list_ids(GObject.TYPE_INT)
# There is no signal 0 in gobject
self.assertEqual(GObject.signal_name(0), None)
- @unittest.skipIf(sys.version_info < (2, 7), 'Requires Python >= 2.7')
def test_signal_lookup_with_invalid_type(self):
with self.assertRaisesRegex(TypeError, 'type must be instantiable or an interface.*'):
GObject.signal_lookup('NOT_A_SIGNAL_NAME', GObject.TYPE_INVALID)
- @unittest.skipIf(sys.version_info < (2, 7), 'Requires Python >= 2.7')
def test_signal_lookup(self):
ids = GObject.signal_list_ids(C)
self.assertEqual(ids[0], GObject.signal_lookup('my_signal', C))