Imported Upstream version 3.25.1 97/138297/1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 11 Jul 2017 23:46:23 +0000 (08:46 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 11 Jul 2017 23:46:27 +0000 (08:46 +0900)
Change-Id: I31412b37aa390505e71295f3a2c2e3cf2ba88b41
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
122 files changed:
ChangeLog
Makefile.am
Makefile.in
NEWS
PKG-INFO
aclocal.m4
autogen.sh
config.h.in
configure
configure.ac
examples/Makefile.in
gi/Makefile.am
gi/Makefile.in
gi/__init__.py
gi/_constants.py
gi/_gobject/Makefile.am [deleted file]
gi/_gobject/Makefile.in [deleted file]
gi/_gobject/__init__.py [deleted file]
gi/_option.py
gi/_propertyhelper.py
gi/_signalhelper.py
gi/gimodule.c
gi/glibmodule.c [deleted file]
gi/gobjectmodule.c
gi/gobjectmodule.h
gi/module.py
gi/overrides/GLib.py
gi/overrides/GObject.py
gi/overrides/Gdk.py
gi/overrides/Gio.py
gi/overrides/Gtk.py
gi/overrides/Makefile.in
gi/overrides/__init__.py
gi/pygboxed.c
gi/pygenum.c
gi/pygflags.c
gi/pygi-argument.c
gi/pygi-array.c
gi/pygi-basictype.c
gi/pygi-cache.c
gi/pygi-closure.c
gi/pygi-error.c
gi/pygi-foreign-cairo.c
gi/pygi-foreign.c
gi/pygi-info.c
gi/pygi-invoke.c
gi/pygi-marshal-cleanup.c
gi/pygi-object.c
gi/pygi-property.c
gi/pygi-signal-closure.c
gi/pygi-signal-closure.h
gi/pygi-source.c
gi/pygi-struct-marshal.c
gi/pygi-util.h
gi/pygi-value.c
gi/pygi-value.h
gi/pyglib-python-compat.h
gi/pyglib.c
gi/pyglib.h
gi/pygobject-object.c
gi/pygobject.h
gi/pygoptioncontext.c
gi/pygoptiongroup.c
gi/pygparamspec.c
gi/pygpointer.c
gi/pygspawn.c
gi/pygtype.c
gi/pygtype.h
gi/repository/Makefile.in
gi/types.py
m4/as-ac-expand.m4 [deleted file]
m4/ax_append_compile_flags.m4 [new file with mode: 0644]
m4/ax_append_flag.m4 [new file with mode: 0644]
m4/ax_append_link_flags.m4 [new file with mode: 0644]
m4/ax_check_compile_flag.m4 [new file with mode: 0644]
m4/ax_check_link_flag.m4 [new file with mode: 0644]
m4/ax_code_coverage.m4 [new file with mode: 0644]
m4/ax_compiler_flags.m4 [new file with mode: 0644]
m4/ax_compiler_flags_cflags.m4 [new file with mode: 0644]
m4/ax_compiler_flags_gir.m4 [new file with mode: 0644]
m4/ax_compiler_flags_ldflags.m4 [new file with mode: 0644]
m4/ax_is_release.m4 [new file with mode: 0644]
m4/ax_require_defined.m4 [new file with mode: 0644]
m4/glib-2.0.m4 [new file with mode: 0644]
m4/introspection.m4 [new file with mode: 0644]
m4/jhflags.m4 [deleted file]
m4/pkg.m4 [new file with mode: 0644]
m4/python.m4
pygtkcompat/Makefile.in
pygtkcompat/pygtkcompat.py
tests/Makefile.am
tests/Makefile.in
tests/compat_test_pygtk.py
tests/compathelper.py
tests/gimarshallingtestsextra.c
tests/gimarshallingtestsextra.h
tests/helper.py
tests/runtests-windows.py [deleted file]
tests/runtests.py
tests/test_atoms.py
tests/test_cairo.py
tests/test_docstring.py
tests/test_everything.py
tests/test_fields.py
tests/test_gdbus.py
tests/test_gi.py
tests/test_gio.py
tests/test_glib.py
tests/test_gobject.py
tests/test_import_machinery.py
tests/test_iochannel.py
tests/test_mainloop.py
tests/test_overrides_gdk.py
tests/test_overrides_gtk.py
tests/test_overrides_pango.py
tests/test_properties.py
tests/test_repository.py
tests/test_signal.py
tests/test_source.py
tests/test_subprocess.py
tests/test_thread.py
tests/testhelpermodule.c

index 86959da..d228364 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,865 @@
-commit 48fb00980464c95f69579688c5390cf0560c4f04
+commit fc451f235754a98c647972f0a03e11eaefca4cef
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Wed Apr 19 15:04:30 2017 +0200
+
+    Bump pycairo requirement to 1.11.1
+
+    This requires pycairo from https://pycairo.readthedocs.io/en/latest/
+    (already updated/included in JHBuild)
+
+    For more info on the upstream change see:
+        https://lists.cairographics.org/archives/cairo/2017-April/027919.html
+        https://mail.gnome.org/archives/desktop-devel-list/2017-April/msg00065.html
+
+    This will enable cairo.Region support for all setups and Python
+    versions as well
+    as make moving to Python 3 easier for applications since all APIs
+    provided
+    under Python 2 are available there as well now.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=707196
+
+ configure.ac | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+commit 36e786e1a2305c001c8c067adfee9d731c2ec0fb
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Thu Apr 20 09:43:50 2017 +0200
+
+    configure.ac: Always disable -Werror
+
+    Instead of disabling it for release builds do it always.
+    While JHBuild uses --disable-Werror by default, gnome-continuous
+    does not.
+
+    See
+    https://mail.gnome.org/archives/desktop-devel-list/2017-April/msg00009.html
+
+ configure.ac | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+commit a2cb674334267e3eaeac5b2ce849c4a38cc1b428
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 9 18:48:33 2017 +0200
+
+    foreign-cairo: Enable cairo.Region support also on Python 2 if
+    available
+
+    The next pycairo version might add support for cairo_region_t.
+    This enables the converter functions also on Python 2 and makes
+    sure that the test suite does not crash in case it does.
+
+ gi/pygi-foreign-cairo.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 3460081ed20b33b3a08c4fce5de135f1171f2ff0
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 2 15:51:25 2017 +0200
+
+    configure.ac: remove unused PLATFORM variable
+
+    This was added in 93e7d047e
+
+ configure.ac | 3 ---
+ 1 file changed, 3 deletions(-)
+
+commit 810392173ce20f8a7935966b46df483742e73f23
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 2 15:25:56 2017 +0200
+
+    configure.ac: Remove unused PySignal_SetWakeupFd check
+
+    HAVE_PYSIGNAL_SETWAKEUPFD isn't used anywhere
+
+ configure.ac | 12 ------------
+ 1 file changed, 12 deletions(-)
+
+commit 52693463749f045355a7ddeace033d369fe2e786
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 2 14:13:08 2017 +0200
+
+    tests: remove python 2.5/3.2 compat code
+
+    2.7/3.3 support the u/b prefixes and both have callable()
+
+ gi/overrides/Gtk.py         |  4 +---
+ tests/compathelper.py       | 40 ----------------------------------------
+ tests/helper.py             |  2 +-
+ tests/test_fields.py        |  6 ++----
+ tests/test_gi.py            | 26 +++++++++-----------------
+ tests/test_glib.py          | 12 +++++-------
+ tests/test_iochannel.py     | 21 +++++++++------------
+ tests/test_mainloop.py      |  4 +---
+ tests/test_overrides_gtk.py | 13 ++++++-------
+ tests/test_properties.py    | 29 ++++++++++++-----------------
+ 10 files changed, 46 insertions(+), 111 deletions(-)
+
+commit 1039e9a512d1df35e9c4656b0b41c1e4a25aafad
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 2 14:04:39 2017 +0200
+
+    configure.ac: Require Python 3.3
+
+    At the time of the next release nothing will support 3.2 anymore.
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit e98558a6843b68115d68d3bc92dad271b74ef6d0
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 2 13:22:32 2017 +0200
+
+    tests: Make test suite run with GTK+ 4
+
+    Skip various tests which test things that are no longer available
+    with gtk4.
+    Does not remove any deprecated overrides.
+
+    Disable gtk4 support in pygtkcompat. The porting path over gtk3
+    should be enough.
+
+ gi/overrides/Gdk.py         |   3 ++
+ pygtkcompat/pygtkcompat.py  |   3 ++
+ tests/compat_test_pygtk.py  |   4 +-
+ tests/test_atoms.py         |   1 +
+ tests/test_overrides_gdk.py |   7 +++
+ tests/test_overrides_gtk.py | 107
+ +++++++++++++++++++++++++++++++++-----------
+ 6 files changed, 98 insertions(+), 27 deletions(-)
+
+commit c3159accf3faa2bd804ac22ec7ac93e62b158a3e
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 2 13:17:36 2017 +0200
+
+    tests: always call require_version; add TEST_GTK_VERSION env var
+
+    Set the versions in runtests.py instead of repeating it in every
+    test module.
+
+    Add a new TEST_GTK_VERSION env var which defaults to "3.0".
+    Allows to run tests with gtk4 using "make check TEST_GTK_VERSION=4.0"
+
+ tests/compat_test_pygtk.py    |  6 ------
+ tests/runtests.py             | 26 ++++++++++++++++++++++++++
+ tests/test_atoms.py           |  7 +++----
+ tests/test_overrides_gtk.py   |  8 +++-----
+ tests/test_overrides_pango.py |  7 +------
+ tests/test_properties.py      |  6 +-----
+ tests/test_repository.py      |  4 ----
+ 7 files changed, 34 insertions(+), 30 deletions(-)
+
+commit c89fa35814103a4ceefece8e305af4f9e0dd6a37
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 2 10:57:34 2017 +0200
+
+    tests: Fix make check.valgrind
+
+    Got broken when we changed to use dbus-run-session. Move
+    valgrind related env vars before the dbus launcher helper.
+
+    This also tries to improve the lookup of the suppression file.
+    Instead of relying on the basename of the python binary use the python
+    major version to select one of two suppression files in the repo.
+
+    Add PYTHONMALLOC=malloc when running under valgrind, which makes
+    Python
+    use malloc instead of its own allocator. Only works with Python 3.6+.
+
+ configure.ac                           |   5 +-
+ tests/Makefile.am                      |  22 +-
+ tests/{python2.7.supp => python2.supp} |   0
+ tests/python3.3dm.supp                 | 471
+ ---------------------------------
+ tests/{python3.3.supp => python3.supp} |   0
+ 5 files changed, 14 insertions(+), 484 deletions(-)
+
+commit 7c774ce5ce9ec5cda61e10a704b28f0b82df1b03
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 2 10:54:48 2017 +0200
+
+    tests: Don't skip Regress tests when cairo is missing
+
+    Since
+    https://git.gnome.org/browse/pygobject/commit/?id=a731db5908b79b97277be4f5138b46010c2dd616
+    we build libregress even if cairo is missing.
+
+    Instead of skipping regress tests when cairo is missing only skip
+    cairo relate
+    tests now.
+
+ tests/test_cairo.py            |  3 +--
+ tests/test_docstring.py        | 10 +++-------
+ tests/test_everything.py       | 17 +----------------
+ tests/test_import_machinery.py |  7 +------
+ tests/test_properties.py       | 32 +++++++++++---------------------
+ tests/test_repository.py       | 10 ----------
+ tests/test_signal.py           | 15 +--------------
+ 7 files changed, 18 insertions(+), 76 deletions(-)
+
+commit c2be3cbefbbacb52758b49338be61d093a896d09
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Apr 2 10:52:41 2017 +0200
+
+    tests: fix invalid regex escaping
+
+    Python 3.6 got stricter here and raises warnings/errors for invalid
+    escape
+    sequences.
+
+ tests/helper.py  |  4 ++--
+ tests/test_gi.py | 24 ++++++++++++------------
+ 2 files changed, 14 insertions(+), 14 deletions(-)
+
+commit b7d504c3ef689a79448c9f6597ae59153a77104f
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sat Apr 1 18:11:46 2017 +0200
+
+    tests: avoid mapping a GtkWindow
+
+    This let to a window being shown when running the test suite.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780812
+
+ tests/test_overrides_gdk.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit a2b3d846fab3a4b660eefbe3555933afe6d9c90a
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sat Apr 1 18:06:47 2017 +0200
+
+    tests: silence some glib deprecation warnings
+
+    These functions were deprecated in the last few cycles.
+    This hides the warnings when running the test suite.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780812
+
+ tests/test_atoms.py         | 7 +++++--
+ tests/test_overrides_gtk.py | 6 ++++--
+ 2 files changed, 9 insertions(+), 4 deletions(-)
+
+commit ed488be1f0bcd2d2ec1acf98f27585d8577ddc5f
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sat Apr 1 18:05:13 2017 +0200
+
+    tests: avoid deprecation warnings for
+    assertRegexpMatches/assertRaisesRegexp
+
+    Replace them with the renamed variants. We can't switch because
+    there is
+    no non-deprecated variant available under both Python 2 and 3.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780812
+
+ tests/runtests.py | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+commit c39bf20cca3d1c6bcf89f93759772117d087b042
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sat Apr 1 17:49:01 2017 +0200
+
+    pygi-source: clear exceptions in finalize handler
+
+    This was executed in the context of Source.__del__ and while Python
+    ignores errors there it started to warn with Python 3.
+
+    This fixes the warnings visible when running test_source under
+    Python 3.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780812
+
+ gi/pygi-source.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit d806a120998e9b38e96d02ab05d28051a441db61
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sat Apr 1 17:48:38 2017 +0200
+
+    Fix pep8 errors
+
+ gi/_option.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit b2529624b3925adbef2671025e08cbf747f162e8
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 27 10:14:22 2017 +0200
+
+    Remove gi._gi._gobject and gi._gobject modules
+
+    Expose everything from _gi._gobject in _gi instead.
+    This does not move any code around, just removes the module.
+
+    Also removes the gi._gobject package and replaces it
+    with a small dummy module in gi.__init__.py
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=735206
+
+ configure.ac            |  1 -
+ gi/Makefile.am          |  3 +-
+ gi/__init__.py          |  9 ++++--
+ gi/_constants.py        | 52 +++++++++++++++----------------
+ gi/_gobject/Makefile.am | 16 ----------
+ gi/_gobject/__init__.py | 23 --------------
+ gi/_propertyhelper.py   | 47 ++++++++++++++--------------
+ gi/_signalhelper.py     |  6 ++--
+ gi/gimodule.c           | 48 ++++++++++++++++++++++-------
+ gi/gobjectmodule.c      | 82
+ +++++++++++--------------------------------------
+ gi/gobjectmodule.h      | 21 +++++++++++++
+ gi/module.py            |  6 ++--
+ gi/overrides/GLib.py    |  3 +-
+ gi/overrides/GObject.py | 82
+ ++++++++++++++++++++++++-------------------------
+ gi/pygi-value.c         |  2 +-
+ gi/pygobject-object.c   | 12 ++++----
+ gi/types.py             | 13 ++++----
+ tests/helper.py         |  4 +--
+ tests/test_gi.py        |  2 +-
+ tests/test_gobject.py   |  8 ++---
+ 20 files changed, 199 insertions(+), 241 deletions(-)
+
+commit bdfafd2bdc84d961bd2df43d8dee690177c77a56
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 27 07:39:22 2017 +0200
+
+    Remove gi._gi._glib module
+
+    Move the code into gi._gi (gimodule)
+    The module was a leftover from
+    https://bugzilla.gnome.org/show_bug.cgi?id=712197
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=735206
+
+ gi/Makefile.am        |  1 -
+ gi/_option.py         | 12 +++++------
+ gi/gimodule.c         | 31 +++++++++++++++-------------
+ gi/glibmodule.c       | 56
+ ---------------------------------------------------
+ gi/overrides/GLib.py  | 10 ++++-----
+ gi/pygoptioncontext.c |  4 ++--
+ gi/pygoptiongroup.c   |  4 ++--
+ gi/pygspawn.c         | 14 ++++++-------
+ 8 files changed, 39 insertions(+), 93 deletions(-)
+
+commit 4ad6899bdca6fbd0fb7e88cd16b49367f7f41267
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 27 06:41:19 2017 +0200
+
+    GValue: add overflow checking for py -> gint; forward marshaling
+    exceptions
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=769789
+
+ gi/pygi-struct-marshal.c |  3 +--
+ gi/pygi-value.c          | 11 ++++++++++-
+ tests/test_gi.py         |  7 ++++++-
+ 3 files changed, 17 insertions(+), 4 deletions(-)
+
+commit 052cea9e2b6e599e52435df3155d8de22500e0f4
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Mar 26 19:34:00 2017 +0200
+
+    pygobject_lookup_class: clear exceptions between calls and don't
+    return with one set
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=773394
+
+ gi/pygobject-object.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+commit 271e94b4e4cc9a9619015ef76880346ad7962ac4
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sat Apr 1 10:15:00 2017 +0200
+
+    Avoid some new deprecation warnings
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780768
+
+ gi/gobjectmodule.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+commit 81625ce4c0164dcb3409471fc38168147af4026a
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Mar 26 16:23:25 2017 +0200
+
+    Raise RuntimeError in case an uninitilialized GObject.Object is
+    marshaled
+
+    One common case where this can happen is when subclassing a
+    GObject.Object
+    without chaining up __init__ and then calling a method.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=730908
+
+ gi/pygi-object.c      | 6 ++++++
+ tests/test_gobject.py | 6 ++++++
+ 2 files changed, 12 insertions(+)
+
+commit b23dea0981ab5718cb26d3a9f4f7bf8f593ac343
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Sun Mar 26 19:11:33 2017 +0200
+
+    closure: support unichar args
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=759276
+
+ gi/pygi-closure.c           |  3 +++
+ tests/test_overrides_gtk.py | 14 ++++++++++++++
+ 2 files changed, 17 insertions(+)
+
+commit d6e46f778ea2bfede89f4fe2422b80998ed7fec8
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Fri Jun 3 15:51:37 2016 +0200
+
+    Add support for bytes and non-utf-8 file names.
+
+    Py2+Unix: Convert unicode to bytes using the fsencoding. Pass bytes
+    as is.
+    Returns path as bytes as is.
+
+    Py2+Windows: Convert unicode to wtf-8. Pass bytes as is.
+    Returns path as bytes as is.
+
+    Py3+Unix: Convert str using os.fsencode so that the surrogateescape
+    handler
+    can restore the real path if the source was a Python API such as
+    os.listdir
+    sys.argv etc. Pass bytes as is. Return str decoded using os.fsdecode
+    so that
+    it can be passed to Python API such as open, os.listdir etc.
+
+    Py3+Windows: Convert str to wtf-8. Decode bytes using the fsencoding
+    first.
+    Returns str + surrogates.
+
+    This change makes anyting taking filenames on Python 3 behave the same
+    as Python functions like listdir() or open(). Compared to Python
+    3 builtin
+    functions which return the same type that was passed in we always
+    return str.
+
+    One remaining problem is that glib assumes that Windows paths
+    are utf-16,
+    while they are just 16bit arrays and as a result utf-8 is not
+    enough to
+    represent all possible paths. We use wtf-8 here instead (utf-8 with
+    lone surrogates),
+    which allows us to convert all paths, but glib functions accessing
+    the fs
+    will fail with them.
+
+    PyUnicode_EncodeFSDefault was added in CPython 3.2 so bump the
+    requirement.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=746564
+
+ configure.ac                    |   2 +-
+ gi/pygi-basictype.c             | 186
+ ++++++++++++++++++++++++++++++++--------
+ gi/pyglib-python-compat.h       |   2 +
+ tests/compathelper.py           |   4 +
+ tests/gimarshallingtestsextra.c |  14 +++
+ tests/gimarshallingtestsextra.h |   1 +
+ tests/test_gi.py                | 152 +++++++++++++++++++++++++++++++-
+ 7 files changed, 320 insertions(+), 41 deletions(-)
+
+commit 33a44c7653030da0a1de76ff8241e40e66d04701
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 27 15:53:13 2017 +0200
+
+    test_gi: use correct min/max constants for gsize/gssize
+
+    This made these tests on 64bit Windows fail because sizeof(gsize)
+    != sizeof(glong)
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780591
+
+ tests/test_gi.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+commit b993e4dc73af976e8140661d2b6e9f745206808e
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 27 14:55:22 2017 +0200
+
+    Don't use long format string for formatting pointers
+
+    long is too small on 64bit Windows
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780591
+
+ gi/pygpointer.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+commit d031e1700816836366989ece0eda486c77543c3b
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 27 14:48:08 2017 +0200
+
+    Fix conversion from pointers to hashfunc return values.
+
+    Fixes comiler warnings on 64bit Windows.
+
+    Python 3 now uses Py_hash_t as return value for hashfunc. Use
+    a compat define so we can use the right type depending on the
+    Python version.
+
+    On Python 2 + 64bit Windows the pointer doesn't fit the long
+    return type. Add a macro which handles the casting for that case
+    to prevent compiler warnings.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780591
+
+ gi/pygboxed.c             | 4 ++--
+ gi/pyglib-python-compat.h | 6 ++++++
+ gi/pygobject-object.c     | 4 ++--
+ gi/pygparamspec.c         | 4 ++--
+ gi/pygpointer.c           | 4 ++--
+ 5 files changed, 14 insertions(+), 8 deletions(-)
+
+commit d2a7e9a7b29e74fd97592fcc8462d718d0b7af17
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 27 14:47:22 2017 +0200
+
+    Fix PyLong <-> GPid conversion on 64bit Windows
+
+    GPid on Windows is a pointer and not int, and pointers don't fit long
+    on 64bit so use PyLong_AsVoidPtr/PyLong_FromVoidPtr there instead.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780591
+
+ gi/pygspawn.c | 26 +++++++++++++++++++++-----
+ 1 file changed, 21 insertions(+), 5 deletions(-)
+
+commit cfeeaaf69f6d6f777e5f3a17493ff9dcc2bda900
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Mar 28 17:58:54 2017 +0200
+
+    property: support setting flags
+
+    This also adds some tests for setting flags and enum properties
+    which depend on some properties being added in g-i's
+    gimarshallingtests:
+        https://bugzilla.gnome.org/show_bug.cgi?id=780652
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=726484
+
+ gi/pygi-property.c       |  3 +++
+ tests/test_properties.py | 34 ++++++++++++++++++++++++++++++++++
+ 2 files changed, 37 insertions(+)
+
+commit 44a51ddd6418f8fa85df5803b8288974bcf20bc2
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Thu Mar 23 15:49:18 2017 +0100
+
+    overrides: warn on instantiation of Gio.VolumeMonitor
+
+    Gio.VolumeMonitor.get() should be used instead
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=744690
+
+ gi/overrides/Gio.py | 19 +++++++++++++++++++
+ tests/test_gio.py   | 11 +++++++++++
+ 2 files changed, 30 insertions(+)
+
+commit 275a92cb7fe530efe83349b3c7da557f22096fc0
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Mar 21 19:19:33 2017 +0100
+
+    Remove gi.overrides.overridefunc
+
+    Move the code into override()
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=686835
+
+ gi/overrides/__init__.py | 32 ++++++++++++++++----------------
+ 1 file changed, 16 insertions(+), 16 deletions(-)
+
+commit f47027d6abde392fff03ce9b49e42a0c6f7d83cd
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Mar 21 12:48:27 2017 +0100
+
+    tests: Reduce usage of timeout_add() and sleep()
+
+    * Instead of waiting for a fixed time, use a timeout and stop the main
+      loop right after the test has succeeded.
+    * Replace time.sleep to sync processes with os.pipe communication
+    * Chain idle sources instead of using multiple timeout sources
+    * Replace sleeps with unbufferd communication
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698548
+
+ tests/test_glib.py          | 37 ++++++++++++-------
+ tests/test_iochannel.py     | 86
+ +++++++++++++++++++++++++++++++++------------
+ tests/test_mainloop.py      | 13 +++++--
+ tests/test_overrides_gtk.py |  4 +--
+ tests/test_source.py        | 10 +++---
+ tests/test_thread.py        |  6 +++-
+ 6 files changed, 111 insertions(+), 45 deletions(-)
+
+commit ab574b6c40b6e58f396c9522be864a78478617c1
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Mar 21 12:43:33 2017 +0100
+
+    tests: Remove TestMainLoop.test_concurrency
+
+    The code containing the bug no longer exists and the test doesn't do
+    what it says. The thread never gets terminated and it doesn't
+    assert anything. And I'm not sure what it should assert.
+
+    For the corresponding bug see
+        https://bugzilla.gnome.org/show_bug.cgi?id=663068
+
+    While the test doesn't hurt, it adds half a second wait time
+    to the test suite.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698548
+
+ tests/test_mainloop.py | 27 ---------------------------
+ 1 file changed, 27 deletions(-)
+
+commit 4da4a1d5c55a5db060bf3f67b708da0a00e3e957
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 27 16:22:12 2017 +0200
+
+    Update .gitignore: add *.dll, *.dylib, .DS_STORE
+
+ .gitignore | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 30228a98299eeb540fd014b9519a9efd4a434d4b
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date:   Thu Mar 23 17:59:55 2017 +0100
+
+    tests: Make test suite run on Windows
+
+    (in a msys2 environment)
+
+    * Replace LD_LIBRARY_PATH with gir code in runtests.py
+    * Remove unneeded runtests-windows.py
+    * Unset MSYSTEM to disable path separator hacks by msys2
+    * Set sys.path in runtests.py
+    * Skip various tests failing/hanging/crashing on Windows
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780396
+
+ tests/Makefile.am           |  9 +++-----
+ tests/compat_test_pygtk.py  |  4 +++-
+ tests/runtests-windows.py   | 52
+ ---------------------------------------------
+ tests/runtests.py           | 13 ++++++++++--
+ tests/test_atoms.py         |  4 +++-
+ tests/test_everything.py    |  2 +-
+ tests/test_gi.py            |  7 +++---
+ tests/test_gio.py           |  3 +++
+ tests/test_glib.py          | 15 +++++++++----
+ tests/test_iochannel.py     | 17 ++++++++++++++-
+ tests/test_mainloop.py      |  4 ++++
+ tests/test_overrides_gdk.py |  3 ++-
+ tests/test_properties.py    |  9 +++++---
+ tests/test_subprocess.py    |  1 +
+ 14 files changed, 68 insertions(+), 75 deletions(-)
+
+commit 23deef70102657e75e07e54b4378c20214c867f3
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Wed Mar 22 14:07:49 2017 +0100
+
+    tests: Make test suite run on macOS
+
+    * Skip all tests which fail, crash or hang.
+    * Disable D-Bus in case dbus-run-session is not available.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780396
+
+ tests/Makefile.am           | 10 +++++++---
+ tests/runtests.py           |  3 +++
+ tests/test_atoms.py         |  3 +++
+ tests/test_gdbus.py         |  9 +++++++++
+ tests/test_gi.py            |  4 ++++
+ tests/test_glib.py          |  2 ++
+ tests/test_overrides_gdk.py |  3 +++
+ tests/test_overrides_gtk.py |  2 ++
+ tests/test_source.py        |  3 +++
+ 9 files changed, 36 insertions(+), 3 deletions(-)
+
+commit 5399bb785e625c36025d6bc1e5cf2b5519759d0d
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Wed Mar 22 19:24:22 2017 +0100
+
+    Fix various compiler warnings for 32bit builds
+
+    Due to the switch to AX_COMPILER_FLAGS which adds some more
+    warning flags. I didn't notice these as they only get triggered
+    on 32bit builds. Tested with gcc 6.3 and clang 3.9.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=780409
+
+ gi/gimodule.c             | 1 +
+ gi/pygboxed.c             | 1 +
+ gi/pygenum.c              | 2 +-
+ gi/pygi-argument.c        | 2 ++
+ gi/pygi-array.c           | 4 ++--
+ gi/pygi-cache.c           | 6 +++---
+ gi/pygi-closure.c         | 4 ++--
+ gi/pygi-foreign-cairo.c   | 2 +-
+ gi/pygi-invoke.c          | 8 ++++----
+ gi/pygi-marshal-cleanup.c | 4 ++--
+ gi/pygi-signal-closure.h  | 1 +
+ gi/pygi-util.h            | 1 +
+ gi/pygi-value.h           | 2 +-
+ gi/pygobject-object.c     | 4 ++--
+ gi/pygtype.h              | 2 +-
+ 15 files changed, 25 insertions(+), 19 deletions(-)
+
+commit 29d07d6e659a518f4e0a7f53eba3dc1d9ba33c3a
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Fri Mar 24 08:25:48 2017 +0100
+
+    pep8 fix
+
+ gi/overrides/Gdk.py | 1 -
+ 1 file changed, 1 deletion(-)
+
+commit b0476e2db4577e12b52caa3163ccb69575221d6c
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Thu Mar 23 22:32:23 2017 +0100
+
+    testhelper: only link against libpython on Windows
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=773803
+
+ configure.ac      |  6 +++---
+ tests/Makefile.am | 11 ++++++++++-
+ 2 files changed, 13 insertions(+), 4 deletions(-)
+
+commit e8c071f518a0e1c3e1877705291d24f056bed77e
+Author: Garrett Regier <garrettregier@gmail.com>
+Date:   Thu Oct 13 15:00:52 2016 -0700
+
+    overrides: Fix Gtk.TextBuffer.insert_with_tags_by_name() with no tags
+
+    The text was not inserted when no tags were provided.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=772896
+
+ gi/overrides/Gtk.py         |  3 ---
+ tests/test_overrides_gtk.py | 12 ++++++++++++
+ 2 files changed, 12 insertions(+), 3 deletions(-)
+
+commit fb0404c0bf08dedf657ce1384b283223b7192df1
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Mar 21 14:03:47 2017 +0100
+
+    Make use of instance-argument annotations
+
+    Use g_callable_info_get_instance_ownership_transfer() instead
+    of hardcoding the transfer for instances.
+
+    get_instance_ownership_transfer() is available since 1.42.0, so no
+    version dependency bump is required.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=735076
+
+ gi/pygi-cache.c          | 4 +++-
+ tests/test_everything.py | 9 +++++++++
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+commit c1ad1129b42c7938662422bb33990026572866d0
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Mar 21 20:23:13 2017 +0100
+
+    Remove pyglib_gil_state_ensure/pyglib_gil_state_release
+
+    Use PyGILState_Ensure/PyGILState_Release instead.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=699440
+
+ gi/gobjectmodule.c       | 40 ++++++++++++++++++++--------------------
+ gi/pygboxed.c            | 14 +++++++-------
+ gi/pygenum.c             |  6 +++---
+ gi/pygflags.c            |  6 +++---
+ gi/pygi-error.c          |  8 ++++----
+ gi/pygi-source.c         | 16 ++++++++--------
+ gi/pyglib.c              |  8 ++++----
+ gi/pyglib.h              |  3 ---
+ gi/pygobject-object.c    | 36 ++++++++++++++++++------------------
+ gi/pygoptiongroup.c      |  9 ++++-----
+ gi/pygpointer.c          |  6 +++---
+ gi/pygspawn.c            |  4 ++--
+ gi/pygtype.c             | 18 +++++++++---------
+ tests/testhelpermodule.c | 12 ++++++------
+ 14 files changed, 91 insertions(+), 95 deletions(-)
+
+commit 16e187636d186d4c128288efb032c5ddd69569b3
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Mar 21 20:05:08 2017 +0100
+
+    Remove support for building without threads
+
+    This removes the --disable-thread configure option.
+
+    * glib removed disable-threads in 2011
+    * We use PyEval_InitThreads() for some time now which means we
+      build against a Python with threads. And nobody complained.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=699440
+
+ configure.ac       | 24 ------------------------
+ gi/gobjectmodule.c |  7 +------
+ gi/pyglib.h        |  9 ++-------
+ gi/pygobject.h     | 19 +++++--------------
+ 4 files changed, 8 insertions(+), 51 deletions(-)
+
+commit 20220d5eac510e3445a96e4e9061fd1bc6ec37c7
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Mar 21 14:46:00 2017 +0100
+
+    pygtkcompat: Allow multiple calls to enable(), enable_gtk() as long
+    as the version matches
+
+    enable_gtk() isn't idempotent and was breaking the API when called
+    multiple times.
+    This ignores the call in case the version passed is the same as for
+    previous calls.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=759009
+
+ pygtkcompat/pygtkcompat.py | 42
+ ++++++++++++++++++++++++++++++++++++++++++
+ tests/compat_test_pygtk.py | 21 +++++++++++++++++++++
+ 2 files changed, 63 insertions(+)
+
+commit 4af42e85a1959cbae06a1bbb7268c76890b60db9
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Mon Feb 22 23:02:22 2016 -0800
+
+    tests: Update Makefile for building tests on OS X
+
+    Pull LDFLAGS into variables for command and Python extension specific.
+    Use -shext .so for the Python extension on both Linux and OS X. The
+    .so is
+    is needed by Python on OS X (not dylib).
+    Remove "all" target and explicit .la targets as these are handled
+    by automake
+    and the "check" target on demand.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=762176
+
+ tests/Makefile.am | 56
+ +++++++++++++++++++++++++++++--------------------------
+ 1 file changed, 30 insertions(+), 26 deletions(-)
+
+commit 3fe9213a3886ffa7a380dc08c5d636cda5865462
+Author: Mikhail Fludkov <misha@pexip.com>
+Date:   Fri Feb 19 16:27:53 2016 +0100
+
+    testhelper: propagate exception if _gobject could not be imported
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=772949
+
+ tests/testhelpermodule.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+commit 399939b55860211e0ab64bdfbfada2c86be8bf64
 Author: Christoph Reiter <creiter@src.gnome.org>
 Date:   Mon Mar 20 18:11:21 2017 +0100
 
@@ -12,15 +873,214 @@ Date:   Mon Mar 20 18:11:21 2017 +0100
  gi/pygi-info.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-commit e0c036d84ee66530498ec71e5388eaf23df2eb95
+commit a731db5908b79b97277be4f5138b46010c2dd616
+Author: Mikhail Fludkov <misha@pexip.com>
+Date:   Fri Oct 14 18:41:48 2016 +0200
+
+    tests: build libregress with disabled cairo
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=772949
+
+ tests/Makefile.am | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+commit 2c329edb870787be1db4d5ecafdf221bead8b271
+Author: Mikhail Fludkov <misha@pexip.com>
+Date:   Fri Oct 14 18:36:21 2016 +0200
+
+    tests: use g-ir utils found by pkg-config
+
+    Use g-ir utils found by pkg-config to not fail if
+    gobject-introspection is not installed systemwide
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=772949
+
+ tests/Makefile.am | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+commit 7a3e4c005a6677ed7bf3ef807cd1a8487b0465de
+Author: Shyouzou Sugitani <shy@users.sourceforge.jp>
+Date:   Mon Jun 6 12:26:44 2016 +0200
+
+    Add a foreign type for cairo_region_t.
+
+    Based on the patch at
+        https://bugzilla.gnome.org/show_bug.cgi?id=667959#c7
+
+    * Rebased on master
+    * Fixes the cairo_region_from_arg signature
+    * Add check for pycairo region support (only in pycairo master)
+    * Add some tests
+
+    Co-Authored-By: Martin Pitt <martin.pitt@ubuntu.com>
+    Co-Authored-By: Christoph Reiter <creiter@src.gnome.org>
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=667959
+
+ gi/pygi-foreign-cairo.c | 51
+ +++++++++++++++++++++++++++++++++++++++++++++++++
+ tests/test_cairo.py     | 28 +++++++++++++++++++++++++--
+ 2 files changed, 77 insertions(+), 2 deletions(-)
+
+commit bb5aa249f1ab6be81f88fdcfb56cee8b3ae2465d
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Jan 24 21:17:07 2017 +0100
+
+    aclocal: make local file discover by reading AC_CONFIG_MACRO_DIR work
+
+    aclocal needs to know where the local macros are for including
+    them and
+    for having a place to put the required system ones in.
+
+    Since 1.13 it can parse configure.ac and get the path from
+    AC_CONFIG_MACRO_DIR.
+    This didn't work because for some reasons it complains if the
+    local macros
+    start with "AM_" even if they are there (I guess it assumes they
+    can't be local).
+
+    To work around that, change the AM prefix to PYG, bump the automake
+    version so
+    we can asume aclocal finds it and remove the hardcoded paths from both
+    autogen.sh and Makefile.am.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=777713
+
+ Makefile.am  |  2 --
+ autogen.sh   |  2 +-
+ configure.ac | 12 +++++-------
+ m4/python.m4 | 12 ++++++------
+ 4 files changed, 12 insertions(+), 16 deletions(-)
+
+commit 8578ed7e9fd0486fd10e71d24f2e9f969793af8d
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Jan 24 18:58:48 2017 +0100
+
+    Port from gnome-common to autoconf-archive
+
+    See https://wiki.gnome.org/Projects/GnomeCommon/Migration
+
+    Visible changes:
+
+    * --enable-compile-warnings is now [no/auto/yes] instead of
+      [no/minimum/yes/maximum/error]
+    * warnings are errors by default except for releases or if
+      --disable-Werror is passed (which is the default in jhbuild)
+
+    AX_APPEND_COMPILE_FLAGS() gets used to disable some warnings
+    enabled by
+    AX_COMPILER_FLAGS() because they trigger with pycairo/python headers.
+
+    Tested with gcc 6.3, clang 3.8.1
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=777713
+
+ .gitignore              |  3 +++
+ Makefile.am             |  8 +++-----
+ autogen.sh              | 44 ++++++++++++++++++++++++++++++--------------
+ configure.ac            | 44 +++++++++++++-------------------------------
+ gi/Makefile.am          | 10 ++++++++++
+ gi/_gobject/Makefile.am |  3 ---
+ m4/as-ac-expand.m4      | 40 ----------------------------------------
+ m4/jhflags.m4           | 21 ---------------------
+ tests/Makefile.am       |  9 ++++++---
+ 9 files changed, 65 insertions(+), 117 deletions(-)
+
+commit f939a71167bd94c9e7777312af444183f7b20441
 Author: Christoph Reiter <creiter@src.gnome.org>
-Date:   Mon Mar 20 16:10:12 2017 +0100
+Date:   Tue Jan 24 18:13:56 2017 +0100
+
+    Fix various potential compiler warnings
+
+    This is useful for a the next commit which switches away from
+    gnome-common and uses AX_COMPILER_FLAGS adding some new compiler
+    warning flags.
 
-    configure.ac: post-release version bump to 3.24.1
+    https://bugzilla.gnome.org/show_bug.cgi?id=777713
+
+ gi/gimodule.c            |  7 ++++---
+ gi/gobjectmodule.c       | 22 +++++++++++-----------
+ gi/pygenum.c             |  2 +-
+ gi/pygflags.c            |  8 ++++----
+ gi/pygi-argument.c       |  2 ++
+ gi/pygi-array.c          | 16 ++++++++--------
+ gi/pygi-cache.c          |  2 ++
+ gi/pygi-closure.c        |  2 +-
+ gi/pygi-foreign.c        |  2 +-
+ gi/pygi-info.c           | 13 ++++++++++---
+ gi/pygi-invoke.c         |  3 +++
+ gi/pygi-property.c       |  2 +-
+ gi/pygi-signal-closure.c |  3 ++-
+ gi/pygi-value.c          | 11 +++++++----
+ gi/pygobject-object.c    | 20 ++++++++++----------
+ 15 files changed, 67 insertions(+), 48 deletions(-)
+
+commit b3fb2ecbb98bd6e40fe49a5b16e5174645886710
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Mon Mar 20 16:39:35 2017 +0100
+
+    configure.ac: post-release version bump to 3.25.0
 
  configure.ac | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
+commit 49cc3643819dad0d065d3c86327cd60d2f022dad
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Jan 24 22:11:23 2017 +0100
+
+    Remove egg make target
+
+    eggs are deprecated and the command was referencing long
+    gone files and failing, so nobody was using it.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=777719
+
+ Makefile.am | 27 ---------------------------
+ 1 file changed, 27 deletions(-)
+
+commit 3aa5c80213194a8a3a993e937bae0f6b3d992547
+Author: Christoph Reiter <creiter@src.gnome.org>
+Date:   Tue Jan 24 22:05:48 2017 +0100
+
+    Remove legacy docs
+
+    They aren't shipped, can't be build and describe the old
+    pygobject 2 interface.
+
+    There also was a doc-dist make target, but it was broken.
+
+    If someone wants to look things up they are in git or still
+    online for 2.28: https://developer.gnome.org/pygobject/stable/
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=777719
+
+ Makefile.am                               |   9 -
+ docs/Makefile.am                          | 112 ----
+ docs/reference/ChangeLog                  | 114 ----
+ docs/reference/entities.docbook.in        |   1 -
+ docs/reference/pyglib-classes.xml         |  13 -
+ docs/reference/pyglib-functions.xml       | 293 ---------
+ docs/reference/pygobject-classes.xml      |  17 -
+ docs/reference/pygobject-constants.xml    | 304 ----------
+ docs/reference/pygobject-functions.xml    | 864
+ ---------------------------
+ docs/reference/pygobject-gboxed.xml       |  68 ---
+ docs/reference/pygobject-ginterface.xml   |  38 --
+ docs/reference/pygobject-gpointer.xml     |  42 --
+ docs/reference/pygobject-introduction.xml | 222 -------
+ docs/reference/pygobject-ref.xml          |  34 --
+ docs/reference/pygobject.xml              | 953
+ ------------------------------
+ docs/style.css                            |  10 -
+ docs/xsl/common.xsl                       |  19 -
+ docs/xsl/devhelp.xsl                      | 154 -----
+ docs/xsl/fixxref.py.in                    |  67 ---
+ docs/xsl/html.xsl                         | 285 ---------
+ docs/xsl/pdf-style.xsl                    |  11 -
+ docs/xsl/pdf.xsl                          | 259 --------
+ docs/xsl/ref-html-style.xsl               |  54 --
+ 23 files changed, 3943 deletions(-)
+
 commit 9d76190bc7a256764b1af5ec4bd05ce4a7b6e1d2
 Author: Christoph Reiter <creiter@src.gnome.org>
 Date:   Mon Mar 20 14:28:51 2017 +0100
index 6171e18..4c91362 100644 (file)
@@ -1,6 +1,3 @@
-ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-AUTOMAKE_OPTIONS = 1.7
-
 # Limit PyFlakes and PEP8 to these directories.
 pycheck_dirs = examples gi tests pygtkcompat
 
@@ -21,9 +18,8 @@ EXTRA_DIST = \
        PKG-INFO \
        PKG-INFO.in \
        pygi-convert.sh \
-       m4/as-ac-expand.m4 \
-       m4/jhflags.m4 \
        m4/python.m4 \
+       m4/introspection.m4 \
        setup.py
 
 MAINTAINERCLEANFILES = \
@@ -91,42 +87,6 @@ endif
 # python
 pyexec_LTLIBRARIES =
 
-# install pth file.
-
-EGG_NAME = $(PACKAGE)-$(PACKAGE_VERSION)-py$(PYTHON_VERSION)-$(PLATFORM)
-
-install-data-local:
-       $(mkinstalldirs) $(DESTDIR)$(pyexecdir)
-       cp $(top_builddir)/PKG-INFO $(DESTDIR)$(pyexecdir)/$(EGG_NAME).egg-info
-install-exec-local:
-       $(mkinstalldirs) $(DESTDIR)$(pyexecdir)
-uninstall-local:
-       rm -f $(DESTDIR)$(pyexecdir)/$(EGG_NAME).egg-info
-
-egg: EGG_TMPDIR:=$(TMPDIR)/$(PACKAGE)-$(PACKAGE_VERSION)
-egg: $(top_srcdir)/gobject/gobject.la PKG-INFO
-       rm -fr $(EGG_TMPDIR)
-       echo $(EGG_NAME).egg
-       $(MKDIR_P) $(EGG_TMPDIR)
-       $(MKDIR_P) $(EGG_TMPDIR)/EGG-INFO
-       $(MAKE) -C gobject install-pkgpyexecLTLIBRARIES pkgpyexecdir=$(EGG_TMPDIR)
-       rm -fr $(EGG_TMPDIR)/gobject.la
-       $(INSTALL) PKG-INFO $(EGG_TMPDIR)/EGG-INFO
-       echo "gobject.so" >> $(EGG_TMPDIR)/EGG-INFO/native_libs.txt
-       ( echo "gobject" ) >> $(EGG_TMPDIR)/EGG-INFO/top_level.txt
-       cd $(EGG_TMPDIR) && zip -rq $(EGG_NAME).egg .
-       mv $(EGG_TMPDIR)/$(EGG_NAME).egg .
-       rm -fr $(EGG_TMPDIR)
-
-doc-dist:
-       mkdir pygobject
-       cp -r docs/html/*.html pygobject
-       cp -r docs/html/*.sgml pygobject
-       cp -r docs/html/*.devhelp pygobject
-       cp -r docs/style.css pygobject
-       tar cfz $(PACKAGE)-docs.tar.gz pygobject
-       rm -fr pygobject
-
 release-news:
        printf "%-8s%s\n" "$(VERSION)" "`LC_TIME=C date '+%d-%b-%Y'`" > NEWS.tmp
 
@@ -203,4 +163,4 @@ check.valgrindlog:
 check.valgrindxml:
        cd tests && $(MAKE) check.valgrindxml
 
-@GNOME_CODE_COVERAGE_RULES@
+@CODE_COVERAGE_RULES@
index 94c17bd..8475090 100644 (file)
@@ -91,10 +91,22 @@ build_triplet = @build@
 host_triplet = @host@
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
-       $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
-       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+       $(top_srcdir)/m4/ax_append_flag.m4 \
+       $(top_srcdir)/m4/ax_append_link_flags.m4 \
+       $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+       $(top_srcdir)/m4/ax_check_link_flag.m4 \
+       $(top_srcdir)/m4/ax_code_coverage.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+       $(top_srcdir)/m4/ax_is_release.m4 \
+       $(top_srcdir)/m4/ax_require_defined.m4 \
+       $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
        $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
@@ -249,7 +261,6 @@ am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -272,7 +283,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DLLTOOL = @DLLTOOL@
@@ -305,8 +315,14 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
 INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
 INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
 LCOV = @LCOV@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
@@ -339,14 +355,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
 PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
 PYCAIRO_LIBS = @PYCAIRO_LIBS@
 PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
 PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
 PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
 PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
 PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
 PYTHON_INCLUDES = @PYTHON_INCLUDES@
 PYTHON_LIBS = @PYTHON_LIBS@
@@ -354,15 +368,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
 PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
 VERSION = @VERSION@
 WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -420,7 +436,6 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AUTOMAKE_OPTIONS = 1.7
 
 # Limit PyFlakes and PEP8 to these directories.
 pycheck_dirs = examples gi tests pygtkcompat
@@ -440,9 +455,8 @@ EXTRA_DIST = \
        PKG-INFO \
        PKG-INFO.in \
        pygi-convert.sh \
-       m4/as-ac-expand.m4 \
-       m4/jhflags.m4 \
        m4/python.m4 \
+       m4/introspection.m4 \
        setup.py
 
 MAINTAINERCLEANFILES = \
@@ -495,9 +509,6 @@ nobase_pyexec_PYTHON = \
 
 # python
 pyexec_LTLIBRARIES = 
-
-# install pth file.
-EGG_NAME = $(PACKAGE)-$(PACKAGE_VERSION)-py$(PYTHON_VERSION)-$(PLATFORM)
 all: config.h
        $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
@@ -1029,14 +1040,13 @@ info: info-recursive
 
 info-am:
 
-install-data-am: install-data-local install-pkgconfigDATA
+install-data-am: install-pkgconfigDATA
 
 install-dvi: install-dvi-recursive
 
 install-dvi-am:
 
-install-exec-am: install-exec-local install-nobase_pyexecPYTHON \
-       install-pyexecLTLIBRARIES
+install-exec-am: install-nobase_pyexecPYTHON install-pyexecLTLIBRARIES
 
 install-html: install-html-recursive
 
@@ -1076,8 +1086,8 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-local uninstall-nobase_pyexecPYTHON \
-       uninstall-pkgconfigDATA uninstall-pyexecLTLIBRARIES
+uninstall-am: uninstall-nobase_pyexecPYTHON uninstall-pkgconfigDATA \
+       uninstall-pyexecLTLIBRARIES
 
 .MAKE: $(am__recursive_targets) all check-am install-am install-strip
 
@@ -1090,17 +1100,17 @@ uninstall-am: uninstall-local uninstall-nobase_pyexecPYTHON \
        distclean-libtool distclean-local distclean-tags \
        distcleancheck distdir distuninstallcheck dvi dvi-am html \
        html-am info info-am install install-am install-data \
-       install-data-am install-data-local install-dvi install-dvi-am \
-       install-exec install-exec-am install-exec-local install-html \
-       install-html-am install-info install-info-am install-man \
-       install-nobase_pyexecPYTHON install-pdf install-pdf-am \
-       install-pkgconfigDATA install-ps install-ps-am \
-       install-pyexecLTLIBRARIES install-strip installcheck \
-       installcheck-am installdirs installdirs-am maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-generic \
-       mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-       uninstall-am uninstall-local uninstall-nobase_pyexecPYTHON \
-       uninstall-pkgconfigDATA uninstall-pyexecLTLIBRARIES
+       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-nobase_pyexecPYTHON \
+       install-pdf install-pdf-am install-pkgconfigDATA install-ps \
+       install-ps-am install-pyexecLTLIBRARIES install-strip \
+       installcheck installcheck-am installdirs installdirs-am \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags tags-am uninstall uninstall-am \
+       uninstall-nobase_pyexecPYTHON uninstall-pkgconfigDATA \
+       uninstall-pyexecLTLIBRARIES
 
 .PRECIOUS: Makefile
 
@@ -1118,38 +1128,6 @@ all-local: build_pylinks
 
 check-local: build_pylinks
 
-install-data-local:
-       $(mkinstalldirs) $(DESTDIR)$(pyexecdir)
-       cp $(top_builddir)/PKG-INFO $(DESTDIR)$(pyexecdir)/$(EGG_NAME).egg-info
-install-exec-local:
-       $(mkinstalldirs) $(DESTDIR)$(pyexecdir)
-uninstall-local:
-       rm -f $(DESTDIR)$(pyexecdir)/$(EGG_NAME).egg-info
-
-egg: EGG_TMPDIR:=$(TMPDIR)/$(PACKAGE)-$(PACKAGE_VERSION)
-egg: $(top_srcdir)/gobject/gobject.la PKG-INFO
-       rm -fr $(EGG_TMPDIR)
-       echo $(EGG_NAME).egg
-       $(MKDIR_P) $(EGG_TMPDIR)
-       $(MKDIR_P) $(EGG_TMPDIR)/EGG-INFO
-       $(MAKE) -C gobject install-pkgpyexecLTLIBRARIES pkgpyexecdir=$(EGG_TMPDIR)
-       rm -fr $(EGG_TMPDIR)/gobject.la
-       $(INSTALL) PKG-INFO $(EGG_TMPDIR)/EGG-INFO
-       echo "gobject.so" >> $(EGG_TMPDIR)/EGG-INFO/native_libs.txt
-       ( echo "gobject" ) >> $(EGG_TMPDIR)/EGG-INFO/top_level.txt
-       cd $(EGG_TMPDIR) && zip -rq $(EGG_NAME).egg .
-       mv $(EGG_TMPDIR)/$(EGG_NAME).egg .
-       rm -fr $(EGG_TMPDIR)
-
-doc-dist:
-       mkdir pygobject
-       cp -r docs/html/*.html pygobject
-       cp -r docs/html/*.sgml pygobject
-       cp -r docs/html/*.devhelp pygobject
-       cp -r docs/style.css pygobject
-       tar cfz $(PACKAGE)-docs.tar.gz pygobject
-       rm -fr pygobject
-
 release-news:
        printf "%-8s%s\n" "$(VERSION)" "`LC_TIME=C date '+%d-%b-%Y'`" > NEWS.tmp
 
@@ -1225,7 +1203,7 @@ check.valgrindlog:
 check.valgrindxml:
        cd tests && $(MAKE) check.valgrindxml
 
-@GNOME_CODE_COVERAGE_RULES@
+@CODE_COVERAGE_RULES@
 
 # 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.
diff --git a/NEWS b/NEWS
index 00283ba..4d01190 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,3 @@
-3.24.1  10-Apr-2017
-        - pygi-info: initialize GIArgument before passing it to g_constant_info_get_value (Christoph Reiter) (#772949)
-        - configure.ac: post-release version bump to 3.24.1 (Christoph Reiter)
-
 3.24.0  20-Mar-2017
         - configure.ac: pre-release version bump to 3.24.0 (Christoph Reiter)
 
index 6084e91..93e54bb 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: PyGObject
-Version: 3.24.1
+Version: 3.25.1
 Summary: Python bindings for GObject
 Home-page: http://www.pygtk.org/
 Author: James Henstridge
@@ -8,7 +8,7 @@ Author-email: james@daa.com.au
 Maintainer: Simon Feltman
 Maintainer-email: sfeltman@src.gnome.org
 License: GNU LGPL
-Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.24/pygobject-3.24.1.tar.gz
+Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.25/pygobject-3.25.1.tar.gz
 Description: Python bindings for GLib and GObject
 Platform: POSIX, Windows
 Classifier: Development Status :: 5 - Production/Stable
index f27dd4b..54823e0 100644 (file)
@@ -20,1004 +20,6 @@ You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# ===========================================================================
-#     http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_CODE_COVERAGE()
-#
-# DESCRIPTION
-#
-#   Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
-#   CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included
-#   in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every
-#   build target (program or library) which should be built with code
-#   coverage support. Also defines CODE_COVERAGE_RULES which should be
-#   substituted in your Makefile; and $enable_code_coverage which can be
-#   used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
-#   and substituted, and corresponds to the value of the
-#   --enable-code-coverage option, which defaults to being disabled.
-#
-#   Test also for gcov program and create GCOV variable that could be
-#   substituted.
-#
-#   Note that all optimisation flags in CFLAGS must be disabled when code
-#   coverage is enabled.
-#
-#   Usage example:
-#
-#   configure.ac:
-#
-#     AX_CODE_COVERAGE
-#
-#   Makefile.am:
-#
-#     @CODE_COVERAGE_RULES@
-#     my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ...
-#     my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
-#     my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
-#     my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
-#
-#   This results in a "check-code-coverage" rule being added to any
-#   Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
-#   has been configured with --enable-code-coverage). Running `make
-#   check-code-coverage` in that directory will run the module's test suite
-#   (`make check`) and build a code coverage report detailing the code which
-#   was touched, then print the URI for the report.
-#
-#   In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined
-#   instead of CODE_COVERAGE_LIBS. They are both still defined, but use of
-#   CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is
-#   deprecated. They have the same value.
-#
-#   This code was derived from Makefile.decl in GLib, originally licenced
-#   under LGPLv2.1+.
-#
-# LICENSE
-#
-#   Copyright (c) 2012, 2016 Philip Withnall
-#   Copyright (c) 2012 Xan Lopez
-#   Copyright (c) 2012 Christian Persch
-#   Copyright (c) 2012 Paolo Borelli
-#   Copyright (c) 2012 Dan Winship
-#   Copyright (c) 2015 Bastien ROUCARIES
-#
-#   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 program. If not, see <http://www.gnu.org/licenses/>.
-
-#serial 17
-
-AC_DEFUN([AX_CODE_COVERAGE],[
-       dnl Check for --enable-code-coverage
-       AC_REQUIRE([AC_PROG_SED])
-
-       # allow to override gcov location
-       AC_ARG_WITH([gcov],
-         [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
-         [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
-         [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
-
-       AC_MSG_CHECKING([whether to build with code coverage support])
-       AC_ARG_ENABLE([code-coverage],
-         AS_HELP_STRING([--enable-code-coverage],
-         [Whether to enable code coverage support]),,
-         enable_code_coverage=no)
-
-       AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
-       AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
-       AC_MSG_RESULT($enable_code_coverage)
-
-       AS_IF([ test "$enable_code_coverage" = "yes" ], [
-               # check for gcov
-               AC_CHECK_TOOL([GCOV],
-                 [$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
-                 [:])
-               AS_IF([test "X$GCOV" = "X:"],
-                 [AC_MSG_ERROR([gcov is needed to do coverage])])
-               AC_SUBST([GCOV])
-
-               dnl Check if gcc is being used
-               AS_IF([ test "$GCC" = "no" ], [
-                       AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
-               ])
-
-               # List of supported lcov versions.
-               lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12"
-
-               AC_CHECK_PROG([LCOV], [lcov], [lcov])
-               AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
-
-               AS_IF([ test "$LCOV" ], [
-                       AC_CACHE_CHECK([for lcov version], ax_cv_lcov_version, [
-                               ax_cv_lcov_version=invalid
-                               lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
-                               for lcov_check_version in $lcov_version_list; do
-                                       if test "$lcov_version" = "$lcov_check_version"; then
-                                               ax_cv_lcov_version="$lcov_check_version (ok)"
-                                       fi
-                               done
-                       ])
-               ], [
-                       lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
-                       AC_MSG_ERROR([$lcov_msg])
-               ])
-
-               case $ax_cv_lcov_version in
-                       ""|invalid[)]
-                               lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
-                               AC_MSG_ERROR([$lcov_msg])
-                               LCOV="exit 0;"
-                       ;;
-               esac
-
-               AS_IF([ test -z "$GENHTML" ], [
-                       AC_MSG_ERROR([Could not find genhtml from the lcov package])
-               ])
-
-               dnl Build the code coverage flags
-               dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
-               CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
-               CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
-               CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
-               CODE_COVERAGE_LDFLAGS="-lgcov"
-               CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
-
-               AC_SUBST([CODE_COVERAGE_CPPFLAGS])
-               AC_SUBST([CODE_COVERAGE_CFLAGS])
-               AC_SUBST([CODE_COVERAGE_CXXFLAGS])
-               AC_SUBST([CODE_COVERAGE_LIBS])
-               AC_SUBST([CODE_COVERAGE_LDFLAGS])
-       ])
-
-[CODE_COVERAGE_RULES='
-# Code coverage
-#
-# Optional:
-#  - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
-#    Multiple directories may be specified, separated by whitespace.
-#    (Default: $(top_builddir))
-#  - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
-#    by lcov for code coverage. (Default:
-#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
-#  - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
-#    reports to be created. (Default:
-#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
-#  - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
-#    set to 0 to disable it and leave empty to stay with the default.
-#    (Default: empty)
-#  - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
-#    instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
-#  - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
-#    instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
-#  - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
-#  - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
-#    collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
-#  - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
-#    instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
-#  - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
-#    lcov instance. (Default: empty)
-#  - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
-#    instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
-#  - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
-#    genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
-#  - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
-#    instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
-#  - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
-#
-# The generated report will be titled using the $(PACKAGE_NAME) and
-# $(PACKAGE_VERSION). In order to add the current git hash to the title,
-# use the git-version-gen script, available online.
-
-# Optional variables
-CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
-CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
-CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
-CODE_COVERAGE_BRANCH_COVERAGE ?=
-CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
---rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
-CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
-CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
-CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
-CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
-CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
-CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
-CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
-$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
---rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
-CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULTS)
-CODE_COVERAGE_IGNORE_PATTERN ?=
-
-code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
-code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
-code_coverage_v_lcov_cap_0 = @echo "  LCOV   --capture"\
- $(CODE_COVERAGE_OUTPUT_FILE);
-code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
-code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
-code_coverage_v_lcov_ign_0 = @echo "  LCOV   --remove /tmp/*"\
- $(CODE_COVERAGE_IGNORE_PATTERN);
-code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
-code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
-code_coverage_v_genhtml_0 = @echo "  GEN   " $(CODE_COVERAGE_OUTPUT_DIRECTORY);
-code_coverage_quiet = $(code_coverage_quiet_$(V))
-code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
-code_coverage_quiet_0 = --quiet
-
-# sanitizes the test-name: replaces with underscores: dashes and dots
-code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
-
-# Use recursive makes in order to ignore errors during check
-check-code-coverage:
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-       -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
-       $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
-else
-       @echo "Need to reconfigure with --enable-code-coverage"
-endif
-
-# Capture code coverage data
-code-coverage-capture: code-coverage-capture-hook
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-       $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
-       $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
-       -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
-       $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
-       @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
-else
-       @echo "Need to reconfigure with --enable-code-coverage"
-endif
-
-# Hook rule executed before code-coverage-capture, overridable by the user
-code-coverage-capture-hook:
-
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-clean: code-coverage-clean
-distclean: code-coverage-clean
-code-coverage-clean:
-       -$(LCOV) --directory $(top_builddir) -z
-       -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-       -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
-endif
-
-GITIGNOREFILES ?=
-GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-
-A''M_DISTCHECK_CONFIGURE_FLAGS ?=
-A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
-
-.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
-']
-
-       AC_SUBST([CODE_COVERAGE_RULES])
-       m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
-])
-
-# Configure paths for GLIB
-# Owen Taylor     1997-2001
-
-dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
-dnl gthread, or gio is specified in MODULES, pass to pkg-config
-dnl
-AC_DEFUN([AM_PATH_GLIB_2_0],
-[dnl 
-dnl Get the cflags and libraries from pkg-config
-dnl
-AC_ARG_ENABLE(glibtest, [  --disable-glibtest      do not try to compile and run a test GLIB program],
-                   , enable_glibtest=yes)
-
-  pkg_config_args=glib-2.0
-  for module in . $4
-  do
-      case "$module" in
-         gmodule) 
-             pkg_config_args="$pkg_config_args gmodule-2.0"
-         ;;
-         gmodule-no-export) 
-             pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
-         ;;
-         gobject) 
-             pkg_config_args="$pkg_config_args gobject-2.0"
-         ;;
-         gthread) 
-             pkg_config_args="$pkg_config_args gthread-2.0"
-         ;;
-         gio*) 
-             pkg_config_args="$pkg_config_args $module-2.0"
-         ;;
-      esac
-  done
-
-  PKG_PROG_PKG_CONFIG([0.16])
-
-  no_glib=""
-
-  if test "x$PKG_CONFIG" = x ; then
-    no_glib=yes
-    PKG_CONFIG=no
-  fi
-
-  min_glib_version=ifelse([$1], ,2.0.0,$1)
-  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
-
-  if test x$PKG_CONFIG != xno ; then
-    ## don't try to run the test against uninstalled libtool libs
-    if $PKG_CONFIG --uninstalled $pkg_config_args; then
-         echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
-         enable_glibtest=no
-    fi
-
-    if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
-         :
-    else
-         no_glib=yes
-    fi
-  fi
-
-  if test x"$no_glib" = x ; then
-    GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
-    GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
-    GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
-    GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
-
-    GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
-    GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
-    glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-    glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-    glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-    if test "x$enable_glibtest" = "xyes" ; then
-      ac_save_CFLAGS="$CFLAGS"
-      ac_save_LIBS="$LIBS"
-      CFLAGS="$CFLAGS $GLIB_CFLAGS"
-      LIBS="$GLIB_LIBS $LIBS"
-dnl
-dnl Now check if the installed GLIB is sufficiently new. (Also sanity
-dnl checks the results of pkg-config to some extent)
-dnl
-      rm -f conf.glibtest
-      AC_TRY_RUN([
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int 
-main ()
-{
-  unsigned int major, minor, micro;
-
-  fclose (fopen ("conf.glibtest", "w"));
-
-  if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, &micro) != 3) {
-     printf("%s, bad version string\n", "$min_glib_version");
-     exit(1);
-   }
-
-  if ((glib_major_version != $glib_config_major_version) ||
-      (glib_minor_version != $glib_config_minor_version) ||
-      (glib_micro_version != $glib_config_micro_version))
-    {
-      printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
-             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
-             glib_major_version, glib_minor_version, glib_micro_version);
-      printf ("*** was found! If pkg-config was correct, then it is best\n");
-      printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
-      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
-      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
-      printf("*** required on your system.\n");
-      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
-      printf("*** to point to the correct configuration files\n");
-    } 
-  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
-          (glib_minor_version != GLIB_MINOR_VERSION) ||
-           (glib_micro_version != GLIB_MICRO_VERSION))
-    {
-      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
-            GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
-      printf("*** library (version %d.%d.%d)\n",
-            glib_major_version, glib_minor_version, glib_micro_version);
-    }
-  else
-    {
-      if ((glib_major_version > major) ||
-        ((glib_major_version == major) && (glib_minor_version > minor)) ||
-        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
-      {
-        return 0;
-       }
-     else
-      {
-        printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n",
-               glib_major_version, glib_minor_version, glib_micro_version);
-        printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n",
-              major, minor, micro);
-        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
-        printf("***\n");
-        printf("*** If you have already installed a sufficiently new version, this error\n");
-        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
-        printf("*** being found. The easiest way to fix this is to remove the old version\n");
-        printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
-        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
-        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
-        printf("*** so that the correct libraries are found at run-time))\n");
-      }
-    }
-  return 1;
-}
-],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
-       CFLAGS="$ac_save_CFLAGS"
-       LIBS="$ac_save_LIBS"
-     fi
-  fi
-  if test "x$no_glib" = x ; then
-     AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
-     ifelse([$2], , :, [$2])     
-  else
-     AC_MSG_RESULT(no)
-     if test "$PKG_CONFIG" = "no" ; then
-       echo "*** A new enough version of pkg-config was not found."
-       echo "*** See http://www.freedesktop.org/software/pkgconfig/"
-     else
-       if test -f conf.glibtest ; then
-        :
-       else
-          echo "*** Could not run GLIB test program, checking why..."
-          ac_save_CFLAGS="$CFLAGS"
-          ac_save_LIBS="$LIBS"
-          CFLAGS="$CFLAGS $GLIB_CFLAGS"
-          LIBS="$LIBS $GLIB_LIBS"
-          AC_TRY_LINK([
-#include <glib.h>
-#include <stdio.h>
-],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
-        [ echo "*** The test program compiled, but did not run. This usually means"
-          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
-          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
-          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
-          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
-          echo "*** is required on your system"
-         echo "***"
-          echo "*** If you have an old version installed, it is best to remove it, although"
-          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
-        [ echo "*** The test program failed to compile or link. See the file config.log for the"
-          echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
-          CFLAGS="$ac_save_CFLAGS"
-          LIBS="$ac_save_LIBS"
-       fi
-     fi
-     GLIB_CFLAGS=""
-     GLIB_LIBS=""
-     GLIB_GENMARSHAL=""
-     GOBJECT_QUERY=""
-     GLIB_MKENUMS=""
-     GLIB_COMPILE_RESOURCES=""
-     ifelse([$3], , :, [$3])
-  fi
-  AC_SUBST(GLIB_CFLAGS)
-  AC_SUBST(GLIB_LIBS)
-  AC_SUBST(GLIB_GENMARSHAL)
-  AC_SUBST(GOBJECT_QUERY)
-  AC_SUBST(GLIB_MKENUMS)
-  AC_SUBST(GLIB_COMPILE_RESOURCES)
-  rm -f conf.glibtest
-])
-
-dnl GNOME_CODE_COVERAGE
-dnl
-dnl Defines CODE_COVERAGE_CFLAGS and CODE_COVERAGE_LDFLAGS which should be
-dnl included in the CFLAGS and LIBS/LDFLAGS variables of every build target
-dnl (program or library) which should be built with code coverage support.
-dnl Also defines GNOME_CODE_COVERAGE_RULES which should be substituted in your
-dnl Makefile; and $enable_code_coverage which can be used in subsequent
-dnl configure output.
-dnl
-dnl Note that all optimisation flags in CFLAGS must be disabled when code
-dnl coverage is enabled.
-dnl
-dnl Derived from Makefile.decl in GLib, originally licenced under LGPLv2.1+.
-dnl This file is licenced under LGPLv2.1+.
-dnl
-dnl Usage example:
-dnl configure.ac:
-dnl    GNOME_CODE_COVERAGE
-dnl
-dnl Makefile.am:
-dnl    @GNOME_CODE_COVERAGE_RULES@
-dnl    my_program_LIBS = … $(CODE_COVERAGE_LDFLAGS) …
-dnl    my_program_CFLAGS = … $(CODE_COVERAGE_CFLAGS) …
-dnl
-dnl This results in a “check-code-coverage” rule being added to any Makefile.am
-dnl which includes “@GNOME_CODE_COVERAGE_RULES@” (assuming the module has been
-dnl configured with --enable-code-coverage). Running `make check-code-coverage`
-dnl in that directory will run the module’s test suite (`make check`) and build
-dnl a code coverage report detailing the code which was touched, then print the
-dnl URI for the report.
-
-AU_DEFUN([GNOME_CODE_COVERAGE],[
-       AX_CODE_COVERAGE
-       GNOME_CODE_COVERAGE_RULES=$CODE_COVERAGE_RULES
-
-       AC_SUBST([GNOME_CODE_COVERAGE_RULES])
-       m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([GNOME_CODE_COVERAGE_RULES])])
-],
-[[$0: This macro is deprecated. You should use AX_CODE_COVERAGE instead and
-replace uses of GNOME_CODE_COVERAGE_RULES with CODE_COVERAGE_RULES.
-See: http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html#ax_code_coverage]])
-
-# gnome-compiler-flags.m4
-#
-# serial 4
-#
-
-dnl GNOME_COMPILE_WARNINGS
-dnl Turn on many useful compiler warnings and substitute the result into
-dnl WARN_CFLAGS
-dnl For now, only works on GCC
-dnl Pass the default value of the --enable-compile-warnings configure option as
-dnl the first argument to the macro, defaulting to 'yes'.
-dnl Additional warning/error flags can be passed as an optional second argument.
-dnl
-dnl For example: GNOME_COMPILE_WARNINGS([maximum],[-Werror=some-flag -Wfoobar])
-AU_DEFUN([GNOME_COMPILE_WARNINGS],[
-    dnl ******************************
-    dnl More compiler warnings
-    dnl ******************************
-
-    AC_ARG_ENABLE(compile-warnings, 
-                  AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
-                                 [Turn on compiler warnings]),,
-                  [enable_compile_warnings="m4_default([$1],[yes])"])
-
-    if test "x$GCC" != xyes; then
-       enable_compile_warnings=no
-    fi
-
-    warning_flags=
-    realsave_CFLAGS="$CFLAGS"
-
-    dnl These are warning flags that aren't marked as fatal.  Can be
-    dnl overridden on a per-project basis with -Wno-foo.
-    base_warn_flags=" \
-        -Wall \
-        -Wstrict-prototypes \
-        -Wnested-externs \
-    "
-
-    dnl These compiler flags typically indicate very broken or suspicious
-    dnl code.  Some of them such as implicit-function-declaration are
-    dnl just not default because gcc compiles a lot of legacy code.
-    dnl We choose to make this set into explicit errors.
-    base_error_flags=" \
-        -Werror=missing-prototypes \
-        -Werror=implicit-function-declaration \
-        -Werror=pointer-arith \
-        -Werror=init-self \
-        -Werror=format-security \
-        -Werror=format=2 \
-        -Werror=missing-include-dirs \
-        -Werror=return-type \
-    "
-
-    dnl Additional warning or error flags provided by the module author to
-    dnl allow stricter standards to be imposed on a per-module basis.
-    dnl The author can pass -W or -Werror flags here as they see fit.
-    additional_flags="m4_default([$2],[])"
-
-    case "$enable_compile_warnings" in
-    no)
-        warning_flags="-w"
-        ;;
-    minimum)
-        warning_flags="-Wall"
-        ;;
-    yes|maximum|error)
-        warning_flags="$base_warn_flags $base_error_flags $additional_flags"
-        ;;
-    *)
-        AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
-        ;;
-    esac
-
-    if test "$enable_compile_warnings" = "error" ; then
-        warning_flags="$warning_flags -Werror"
-    fi
-
-    dnl Check whether GCC supports the warning options
-    for option in $warning_flags; do
-       save_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS $option"
-       AC_MSG_CHECKING([whether gcc understands $option])
-       AC_TRY_COMPILE([], [],
-           has_option=yes,
-           has_option=no,)
-       CFLAGS="$save_CFLAGS"
-       AC_MSG_RESULT([$has_option])
-       if test $has_option = yes; then
-           tested_warning_flags="$tested_warning_flags $option"
-       fi
-       unset has_option
-       unset save_CFLAGS
-    done
-    unset option
-    CFLAGS="$realsave_CFLAGS"
-    AC_MSG_CHECKING(what warning flags to pass to the C compiler)
-    AC_MSG_RESULT($tested_warning_flags)
-
-    AC_ARG_ENABLE(iso-c,
-                  AS_HELP_STRING([--enable-iso-c],
-                                 [Try to warn if code is not ISO C ]),,
-                  [enable_iso_c=no])
-
-    AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
-    complCFLAGS=
-    if test "x$enable_iso_c" != "xno"; then
-       if test "x$GCC" = "xyes"; then
-       case " $CFLAGS " in
-           *[\ \       ]-ansi[\ \      ]*) ;;
-           *) complCFLAGS="$complCFLAGS -ansi" ;;
-       esac
-       case " $CFLAGS " in
-           *[\ \       ]-pedantic[\ \  ]*) ;;
-           *) complCFLAGS="$complCFLAGS -pedantic" ;;
-       esac
-       fi
-    fi
-    AC_MSG_RESULT($complCFLAGS)
-
-    WARN_CFLAGS="$tested_warning_flags $complCFLAGS"
-    AC_SUBST(WARN_CFLAGS)
-],
-[[$0: This macro is deprecated. You should use AX_COMPILER_FLAGS instead and
-eliminate use of --enable-iso-c.
-See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]])
-
-dnl For C++, do basically the same thing.
-
-AU_DEFUN([GNOME_CXX_WARNINGS],[
-  AC_ARG_ENABLE(cxx-warnings,
-                AS_HELP_STRING([--enable-cxx-warnings=@<:@no/minimum/yes@:>@]
-                               [Turn on compiler warnings.]),,
-                [enable_cxx_warnings="m4_default([$1],[minimum])"])
-
-  AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
-  warnCXXFLAGS=
-  if test "x$GXX" != xyes; then
-    enable_cxx_warnings=no
-  fi
-  if test "x$enable_cxx_warnings" != "xno"; then
-    if test "x$GXX" = "xyes"; then
-      case " $CXXFLAGS " in
-      *[\ \    ]-Wall[\ \      ]*) ;;
-      *) warnCXXFLAGS="-Wall -Wno-unused" ;;
-      esac
-
-      ## -W is not all that useful.  And it cannot be controlled
-      ## with individual -Wno-xxx flags, unlike -Wall
-      if test "x$enable_cxx_warnings" = "xyes"; then
-       warnCXXFLAGS="$warnCXXFLAGS -Wshadow -Woverloaded-virtual"
-      fi
-    fi
-  fi
-  AC_MSG_RESULT($warnCXXFLAGS)
-
-   AC_ARG_ENABLE(iso-cxx,
-                 AS_HELP_STRING([--enable-iso-cxx],
-                                [Try to warn if code is not ISO C++ ]),,
-                 [enable_iso_cxx=no])
-
-   AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
-   complCXXFLAGS=
-   if test "x$enable_iso_cxx" != "xno"; then
-     if test "x$GXX" = "xyes"; then
-      case " $CXXFLAGS " in
-      *[\ \    ]-ansi[\ \      ]*) ;;
-      *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
-      esac
-
-      case " $CXXFLAGS " in
-      *[\ \    ]-pedantic[\ \  ]*) ;;
-      *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
-      esac
-     fi
-   fi
-  AC_MSG_RESULT($complCXXFLAGS)
-
-  WARN_CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
-  AC_SUBST(WARN_CXXFLAGS)
-],
-[[$0: This macro is deprecated. You should use AX_COMPILER_FLAGS instead and
-eliminate use of --enable-iso-cxx.
-See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]])
-
-dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29)
-dnl
-dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
-dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-dnl 02111-1307, USA.
-dnl
-dnl As a special exception to the GNU General Public License, if you
-dnl distribute this file as part of a program that contains a
-dnl configuration script generated by Autoconf, you may include it under
-dnl the same distribution terms that you use for the rest of that
-dnl program.
-
-dnl PKG_PREREQ(MIN-VERSION)
-dnl -----------------------
-dnl Since: 0.29
-dnl
-dnl Verify that the version of the pkg-config macros are at least
-dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
-dnl installed version of pkg-config, this checks the developer's version
-dnl of pkg.m4 when generating configure.
-dnl
-dnl To ensure that this macro is defined, also add:
-dnl m4_ifndef([PKG_PREREQ],
-dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
-dnl
-dnl See the "Since" comment for each macro you use to see what version
-dnl of the macros you require.
-m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29])
-m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
-    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
-])dnl PKG_PREREQ
-
-dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
-dnl ----------------------------------
-dnl Since: 0.16
-dnl
-dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
-dnl first found in the path. Checks that the version of pkg-config found
-dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
-dnl used since that's the first version where most current features of
-dnl pkg-config existed.
-AC_DEFUN([PKG_PROG_PKG_CONFIG],
-[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
-m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
-AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
-AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
-AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-fi
-if test -n "$PKG_CONFIG"; then
-       _pkg_min_version=m4_default([$1], [0.9.0])
-       AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
-       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-               AC_MSG_RESULT([yes])
-       else
-               AC_MSG_RESULT([no])
-               PKG_CONFIG=""
-       fi
-fi[]dnl
-])dnl PKG_PROG_PKG_CONFIG
-
-dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-dnl -------------------------------------------------------------------
-dnl Since: 0.18
-dnl
-dnl Check to see whether a particular set of modules exists. Similar to
-dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
-dnl
-dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-dnl only at the first occurence in configure.ac, so if the first place
-dnl it's called might be skipped (such as if it is within an "if", you
-dnl have to call PKG_CHECK_EXISTS manually
-AC_DEFUN([PKG_CHECK_EXISTS],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-if test -n "$PKG_CONFIG" && \
-    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
-  m4_default([$2], [:])
-m4_ifvaln([$3], [else
-  $3])dnl
-fi])
-
-dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-dnl ---------------------------------------------
-dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
-dnl pkg_failed based on the result.
-m4_define([_PKG_CONFIG],
-[if test -n "$$1"; then
-    pkg_cv_[]$1="$$1"
- elif test -n "$PKG_CONFIG"; then
-    PKG_CHECK_EXISTS([$3],
-                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
-                     test "x$?" != "x0" && pkg_failed=yes ],
-                    [pkg_failed=yes])
- else
-    pkg_failed=untried
-fi[]dnl
-])dnl _PKG_CONFIG
-
-dnl _PKG_SHORT_ERRORS_SUPPORTED
-dnl ---------------------------
-dnl Internal check to see if pkg-config supports short errors.
-AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi[]dnl
-])dnl _PKG_SHORT_ERRORS_SUPPORTED
-
-
-dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-dnl   [ACTION-IF-NOT-FOUND])
-dnl --------------------------------------------------------------
-dnl Since: 0.4.0
-dnl
-dnl Note that if there is a possibility the first call to
-dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
-dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
-
-pkg_failed=no
-AC_MSG_CHECKING([for $1])
-
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-
-m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-and $1[]_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.])
-
-if test $pkg_failed = yes; then
-       AC_MSG_RESULT([no])
-        _PKG_SHORT_ERRORS_SUPPORTED
-        if test $_pkg_short_errors_supported = yes; then
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
-        else 
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
-        fi
-       # Put the nasty error message in config.log where it belongs
-       echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
-
-       m4_default([$4], [AC_MSG_ERROR(
-[Package requirements ($2) were not met:
-
-$$1_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-_PKG_TEXT])[]dnl
-        ])
-elif test $pkg_failed = untried; then
-       AC_MSG_RESULT([no])
-       m4_default([$4], [AC_MSG_FAILURE(
-[The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-_PKG_TEXT
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
-        ])
-else
-       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
-       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
-        AC_MSG_RESULT([yes])
-       $3
-fi[]dnl
-])dnl PKG_CHECK_MODULES
-
-
-dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-dnl   [ACTION-IF-NOT-FOUND])
-dnl ---------------------------------------------------------------------
-dnl Since: 0.29
-dnl
-dnl Checks for existence of MODULES and gathers its build flags with
-dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
-dnl and VARIABLE-PREFIX_LIBS from --libs.
-dnl
-dnl Note that if there is a possibility the first call to
-dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
-dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
-dnl configure.ac.
-AC_DEFUN([PKG_CHECK_MODULES_STATIC],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-_save_PKG_CONFIG=$PKG_CONFIG
-PKG_CONFIG="$PKG_CONFIG --static"
-PKG_CHECK_MODULES($@)
-PKG_CONFIG=$_save_PKG_CONFIG[]dnl
-])dnl PKG_CHECK_MODULES_STATIC
-
-
-dnl PKG_INSTALLDIR([DIRECTORY])
-dnl -------------------------
-dnl Since: 0.27
-dnl
-dnl Substitutes the variable pkgconfigdir as the location where a module
-dnl should install pkg-config .pc files. By default the directory is
-dnl $libdir/pkgconfig, but the default can be changed by passing
-dnl DIRECTORY. The user can override through the --with-pkgconfigdir
-dnl parameter.
-AC_DEFUN([PKG_INSTALLDIR],
-[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
-m4_pushdef([pkg_description],
-    [pkg-config installation directory @<:@]pkg_default[@:>@])
-AC_ARG_WITH([pkgconfigdir],
-    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
-    [with_pkgconfigdir=]pkg_default)
-AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
-m4_popdef([pkg_default])
-m4_popdef([pkg_description])
-])dnl PKG_INSTALLDIR
-
-
-dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
-dnl --------------------------------
-dnl Since: 0.27
-dnl
-dnl Substitutes the variable noarch_pkgconfigdir as the location where a
-dnl module should install arch-independent pkg-config .pc files. By
-dnl default the directory is $datadir/pkgconfig, but the default can be
-dnl changed by passing DIRECTORY. The user can override through the
-dnl --with-noarch-pkgconfigdir parameter.
-AC_DEFUN([PKG_NOARCH_INSTALLDIR],
-[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
-m4_pushdef([pkg_description],
-    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
-AC_ARG_WITH([noarch-pkgconfigdir],
-    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
-    [with_noarch_pkgconfigdir=]pkg_default)
-AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
-m4_popdef([pkg_default])
-m4_popdef([pkg_description])
-])dnl PKG_NOARCH_INSTALLDIR
-
-
-dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
-dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-dnl -------------------------------------------
-dnl Since: 0.28
-dnl
-dnl Retrieves the value of the pkg-config variable for the given module.
-AC_DEFUN([PKG_CHECK_VAR],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
-
-_PKG_CONFIG([$1], [variable="][$3]["], [$2])
-AS_VAR_COPY([$1], [pkg_cv_][$1])
-
-AS_VAR_IF([$1], [""], [$5], [$4])dnl
-])dnl PKG_CHECK_VAR
-
 # Copyright (C) 2002-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
@@ -2383,11 +1385,24 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
-m4_include([m4/as-ac-expand.m4])
-m4_include([m4/jhflags.m4])
+m4_include([m4/ax_append_compile_flags.m4])
+m4_include([m4/ax_append_flag.m4])
+m4_include([m4/ax_append_link_flags.m4])
+m4_include([m4/ax_check_compile_flag.m4])
+m4_include([m4/ax_check_link_flag.m4])
+m4_include([m4/ax_code_coverage.m4])
+m4_include([m4/ax_compiler_flags.m4])
+m4_include([m4/ax_compiler_flags_cflags.m4])
+m4_include([m4/ax_compiler_flags_gir.m4])
+m4_include([m4/ax_compiler_flags_ldflags.m4])
+m4_include([m4/ax_is_release.m4])
+m4_include([m4/ax_require_defined.m4])
+m4_include([m4/glib-2.0.m4])
+m4_include([m4/introspection.m4])
 m4_include([m4/libtool.m4])
 m4_include([m4/ltoptions.m4])
 m4_include([m4/ltsugar.m4])
 m4_include([m4/ltversion.m4])
 m4_include([m4/lt~obsolete.m4])
+m4_include([m4/pkg.m4])
 m4_include([m4/python.m4])
index f58b081..56b7d0a 100755 (executable)
@@ -1,21 +1,37 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
-set -e
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
+test -n "$srcdir" || srcdir=$(dirname "$0")
+test -n "$srcdir" || srcdir=.
 
-PKG_NAME="pygobject"
+olddir=$(pwd)
 
-(test -f $srcdir/configure.ac \
-  && test -f $srcdir/$PKG_NAME.doap) || {
-    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
-    echo " top-level $PKG_NAME directory"
-    exit 1
-}
+cd $srcdir
 
-which gnome-autogen.sh || {
-    echo "You need to install gnome-common."
-    exit 1
+(test -f configure.ac) || {
+        echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***"
+        exit 1
 }
 
-. gnome-autogen.sh "$@"
+# shellcheck disable=SC2016
+PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
+
+if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
+        echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
+        echo "*** If you wish to pass any to it, please specify them on the" >&2
+        echo "*** '$0' command line." >&2
+        echo "" >&2
+fi
+
+aclocal --install || exit 1
+autoreconf --verbose --force --install || exit 1
+
+cd "$olddir"
+if [ "$NOCONFIGURE" = "" ]; then
+        $srcdir/configure "$@" || exit 1
+
+        if [ "$1" = "--help" ]; then exit 0 else
+                echo "Now type 'make' to compile $PKG_NAME" || exit 1
+        fi
+else
+        echo "Skipping configure process."
+fi
index f35e1bf..81ef751 100644 (file)
@@ -9,9 +9,6 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
-/* Define to 1 if PySignal_SetWakeupFd is available */
-#undef HAVE_PYSIGNAL_SETWAKEUPFD
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
index 6a0380c..6807722 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pygobject 3.24.1.
+# Generated by GNU Autoconf 2.69 for pygobject 3.25.1.
 #
 # Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
 #
@@ -591,8 +591,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='pygobject'
 PACKAGE_TARNAME='pygobject'
-PACKAGE_VERSION='3.24.1'
-PACKAGE_STRING='pygobject 3.24.1'
+PACKAGE_VERSION='3.25.1'
+PACKAGE_STRING='pygobject 3.25.1'
 PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
 PACKAGE_URL='https://wiki.gnome.org/Projects/PyGObject/'
 
@@ -637,7 +637,6 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
-GNOME_CODE_COVERAGE_RULES
 CODE_COVERAGE_RULES
 CODE_COVERAGE_LDFLAGS
 CODE_COVERAGE_LIBS
@@ -650,9 +649,9 @@ GCOV
 CODE_COVERAGE_ENABLED
 CODE_COVERAGE_ENABLED_FALSE
 CODE_COVERAGE_ENABLED_TRUE
+WARN_SCANNERFLAGS
+WARN_LDFLAGS
 WARN_CFLAGS
-INTROSPECTION_COMPILER
-INTROSPECTION_SCANNER
 WITH_COMMON_FALSE
 WITH_COMMON_TRUE
 ENABLE_CAIRO_FALSE
@@ -662,6 +661,16 @@ PYCAIRO_CFLAGS
 CAIRO_LIBS
 CAIRO_CFLAGS
 GI_DATADIR
+HAVE_INTROSPECTION_FALSE
+HAVE_INTROSPECTION_TRUE
+INTROSPECTION_MAKEFILE
+INTROSPECTION_LIBS
+INTROSPECTION_CFLAGS
+INTROSPECTION_TYPELIBDIR
+INTROSPECTION_GIRDIR
+INTROSPECTION_GENERATE
+INTROSPECTION_COMPILER
+INTROSPECTION_SCANNER
 GI_LIBS
 GI_CFLAGS
 GIO_LIBS
@@ -669,8 +678,7 @@ GIO_CFLAGS
 LIBFFI_PC
 FFI_LIBS
 FFI_CFLAGS
-DATADIR
-PYTHON_BASENAME
+PYTHON_VALGRIND_SUPP
 GLIB_COMPILE_RESOURCES
 GLIB_MKENUMS
 GOBJECT_QUERY
@@ -680,8 +688,6 @@ GLIB_CFLAGS
 PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
-THREADING_CFLAGS
-PLATFORM
 PYTHON_LIB_LOC
 PYTHON_LIBS
 PYTHON_INCLUDES
@@ -777,7 +783,6 @@ AM_V
 PYGOBJECT_MICRO_VERSION
 PYGOBJECT_MINOR_VERSION
 PYGOBJECT_MAJOR_VERSION
-ACLOCAL_AMFLAGS
 target_alias
 host_alias
 build_alias
@@ -831,12 +836,12 @@ with_gnu_ld
 with_sysroot
 enable_libtool_lock
 with_python
-enable_thread
 enable_glibtest
 enable_cairo
+enable_introspection
 with_common
 enable_compile_warnings
-enable_iso_c
+enable_Werror
 with_gcov
 enable_code_coverage
 '
@@ -1414,7 +1419,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures pygobject 3.24.1 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.25.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1485,7 +1490,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of pygobject 3.24.1:";;
+     short | recursive ) echo "Configuration of pygobject 3.25.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1504,13 +1509,14 @@ Optional Features:
   --disable-dependency-tracking
                           speeds up one-time build
   --disable-libtool-lock  avoid locking (might break parallel builds)
-  --disable-thread        Disable pygobject threading support
   --disable-glibtest      do not try to compile and run a test GLIB program
   --enable-cairo          Enable Cairo bindings using introspection
                           information
-  --enable-compile-warnings=[no/minimum/yes/maximum/error]
-                          Turn on compiler warnings
-  --enable-iso-c          Try to warn if code is not ISO C
+  --enable-introspection=[no/auto/yes]
+                          Enable introspection for this build
+  --enable-compile-warnings=[no/yes/error]
+                          Enable compiler warnings and errors
+  --disable-Werror        Unconditionally make all compiler warnings non-fatal
   --enable-code-coverage  Whether to enable code coverage support
 
 Optional Packages:
@@ -1629,7 +1635,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-pygobject configure 3.24.1
+pygobject configure 3.25.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1907,7 +1913,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by pygobject $as_me 3.24.1, which was
+It was created by pygobject $as_me 3.25.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2255,7 +2261,18 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-ACLOCAL_AMFLAGS="-I m4 -I ."
+
+
+
+
+        # $is_release = ($minor_version is even)
+        minor_version=`echo "$PACKAGE_VERSION" | sed 's/[^.][^.]*.\([^.][^.]*\).*/\1/'`
+        if test "$(( $minor_version % 2 ))" -ne 0; then :
+  ax_is_release=no
+else
+  ax_is_release=yes
+fi
+
 
 
 
@@ -2266,9 +2283,9 @@ $as_echo "#define PYGOBJECT_MAJOR_VERSION 3" >>confdefs.h
 PYGOBJECT_MAJOR_VERSION=3
 
 
-$as_echo "#define PYGOBJECT_MINOR_VERSION 24" >>confdefs.h
+$as_echo "#define PYGOBJECT_MINOR_VERSION 25" >>confdefs.h
 
-PYGOBJECT_MINOR_VERSION=24
+PYGOBJECT_MINOR_VERSION=25
 
 
 $as_echo "#define PYGOBJECT_MICRO_VERSION 1" >>confdefs.h
@@ -2317,8 +2334,6 @@ else
 fi
 AM_BACKSLASH='\'
 
-# 1.12.6 to get a py-compile supporting newer Python 3 versions.
-# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=8847
 am__api_version='1.15'
 
 ac_aux_dir=
@@ -2795,7 +2810,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='pygobject'
- VERSION='3.24.1'
+ VERSION='3.25.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2889,8 +2904,6 @@ END
 fi
 
 
-ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
-
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
   as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
@@ -2962,8 +2975,8 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for build time linking with Python (Darwin and Win32)" >&5
-$as_echo_n "checking for build time linking with Python (Darwin and Win32)... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for build time linking with Python (Win32)" >&5
+$as_echo_n "checking for build time linking with Python (Win32)... " >&6; }
 case "$host" in
   *-*-mingw*|*-*-cygwin*)
     os_win32=yes
@@ -2972,7 +2985,7 @@ case "$host" in
     ;;
   *-*-darwin*)
     os_win32=no
-    link_python_libs=yes
+    link_python_libs=no
     OS_EXT=dylib
     ;;
   *)
 
 # if building for python 3 make sure we have the minimum version supported
 if test $build_py3k = true ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $PYTHON >= 3.1" >&5
-$as_echo_n "checking for $PYTHON >= 3.1... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $PYTHON >= 3.3" >&5
+$as_echo_n "checking for $PYTHON >= 3.3... " >&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, '3.1'.split('.'))) + [0, 0, 0]
+minver = list(map(int, '3.3'.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]
@@ -13662,7 +13675,7 @@ if ac_fn_c_try_link "$LINENO"; then :
 $as_echo "yes" >&6; };
 else
            LIBS="$save_LIBS"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; as_fn_error $? "Python libs not found. Windows and Darwin require Python modules to be explicitly linked to libpython." "$LINENO" 5
+$as_echo "no" >&6; }; as_fn_error $? "Python libs not found. Windows requires Python modules to be explicitly linked to libpython." "$LINENO" 5
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
@@ -13670,139 +13683,6 @@ rm -f core conftest.err conftest.$ac_objext \
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PySignal_SetWakeupFd in Python.h" >&5
-$as_echo_n "checking for PySignal_SetWakeupFd in Python.h... " >&6; }
-old_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="-Wall -Werror $PYTHON_INCLUDES"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <Python.h>
-int
-main ()
-{
-PySignal_SetWakeupFd(0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  setwakeupfd_ok=yes
-else
-  setwakeupfd_ok=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $setwakeupfd_ok" >&5
-$as_echo "$setwakeupfd_ok" >&6; }
-if test "x$setwakeupfd_ok" != xno; then
-
-$as_echo "#define HAVE_PYSIGNAL_SETWAKEUPFD 1" >>confdefs.h
-
-fi
-CPPFLAGS=$old_CPPFLAGS
-
-PLATFORM=`$PYTHON -c "import sys; from distutils import util; sys.stdout.write(util.get_platform())"`
-
-
-# Check whether --enable-thread was given.
-if test "${enable_thread+set}" = set; then :
-  enableval=$enable_thread;
-else
-  enable_thread=yes
-fi
-
-
-
-py_mod_var=`echo thread'_' | sed 'y%./+-%__p_%'`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python module thread" >&5
-$as_echo_n "checking for python module thread... " >&6; }
-if eval \${py_cv_mod_$py_mod_var+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-prog="
-import sys
-try:
-        import thread
-except ImportError:
-        sys.exit(1)
-except:
-        sys.exit(0)
-sys.exit(0)"
-if $PYTHON -c "$prog" 1>&5 2>&5
-  then
-    eval "py_cv_mod_$py_mod_var=yes"
-  else
-    eval "py_cv_mod_$py_mod_var=no"
-  fi
-
-fi
-
-py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
-if test "x$py_val" != xno; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-  else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  enable_thread=check_for_py3_module
-fi
-
-if test "x$enable_thread" = xcheck_for_py3_module; then
-
-py_mod_var=`echo _thread'_' | sed 'y%./+-%__p_%'`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python module _thread" >&5
-$as_echo_n "checking for python module _thread... " >&6; }
-if eval \${py_cv_mod_$py_mod_var+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-prog="
-import sys
-try:
-        import _thread
-except ImportError:
-        sys.exit(1)
-except:
-        sys.exit(0)
-sys.exit(0)"
-if $PYTHON -c "$prog" 1>&5 2>&5
-  then
-    eval "py_cv_mod_$py_mod_var=yes"
-  else
-    eval "py_cv_mod_$py_mod_var=no"
-  fi
-
-fi
-
-py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
-if test "x$py_val" != xno; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-  enable_thread=yes
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  enable_thread=no
-fi
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable threading in pygobject" >&5
-$as_echo_n "checking whether to enable threading in pygobject... " >&6; }
-if test "x$enable_thread" != xno; then
-  extra_mods=gthread
-  THREADING_CFLAGS=
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  extra_mods=
-  THREADING_CFLAGS="-DDISABLE_THREADING"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-CPPFLAGS="${CPPFLAGS} $THREADING_CFLAGS"
-
 export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
 
 # Check whether --enable-glibtest was given.
@@ -14161,36 +14041,8 @@ rm -f core conftest.err conftest.$ac_objext \
 if test -n "$export_dynamic"; then
   GLIB_LIBS=`echo $GLIB_LIBS | sed -e "s/$export_dynamic//"`
 fi
-PYTHON_BASENAME=`basename $PYTHON`
-
-
-
-  EXP_VAR=DATADIR
-  FROM_VAR=$datadir
-
-    prefix_save=$prefix
-  exec_prefix_save=$exec_prefix
-
-    if test "x$prefix" = "xNONE"; then
-    prefix=$ac_default_prefix
-  fi
-    if test "x$exec_prefix" = "xNONE"; then
-    exec_prefix=$prefix
-  fi
-
-  full_var="$FROM_VAR"
-    while true; do
-    new_full_var="`eval echo $full_var`"
-    if test "x$new_full_var"="x$full_var"; then break; fi
-    full_var=$new_full_var
-  done
-
-    full_var=$new_full_var
-  DATADIR="$full_var"
 
-
-    prefix=$prefix_save
-  exec_prefix=$exec_prefix_save
+PYTHON_VALGRIND_SUPP=`$PYTHON -c "import sys; sys.stdout.write('python' + sys.version.__getitem__(0))"`
 
 
 
@@ -14500,6 +14352,101 @@ $as_echo "yes" >&6; }
 
 fi
 
+
+
+
+                # Check whether --enable-introspection was given.
+if test "${enable_introspection+set}" = set; then :
+  enableval=$enable_introspection;
+else
+  enable_introspection=auto
+fi
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gobject-introspection" >&5
+$as_echo_n "checking for gobject-introspection... " >&6; }
+
+        case $enable_introspection in #(
+  no) :
+            found_introspection="no (disabled, use --enable-introspection to enable)"
+     ;; #(
+      yes) :
+            if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  :
+else
+  as_fn_error $? "gobject-introspection-1.0 is not installed" "$LINENO" 5
+fi
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 1.46.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 1.46.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  found_introspection=yes
+else
+  as_fn_error $? "You need to have gobject-introspection >= 1.46.0 installed to build pygobject" "$LINENO" 5
+fi
+     ;; #(
+      auto) :
+            if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 1.46.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 1.46.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  found_introspection=yes
+else
+  found_introspection=no
+fi
+               enable_introspection=$found_introspection
+     ;; #(
+  *) :
+                as_fn_error $? "invalid argument passed to --enable-introspection, should be one of [no/auto/yes]" "$LINENO" 5
+     ;;
+esac
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found_introspection" >&5
+$as_echo "$found_introspection" >&6; }
+
+    INTROSPECTION_SCANNER=
+    INTROSPECTION_COMPILER=
+    INTROSPECTION_GENERATE=
+    INTROSPECTION_GIRDIR=
+    INTROSPECTION_TYPELIBDIR=
+    if test "x$found_introspection" = "xyes"; then
+       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+    fi
+
+
+
+
+
+
+
+
+
+     if test "x$found_introspection" = "xyes"; then
+  HAVE_INTROSPECTION_TRUE=
+  HAVE_INTROSPECTION_FALSE='#'
+else
+  HAVE_INTROSPECTION_TRUE='#'
+  HAVE_INTROSPECTION_FALSE=
+fi
+
+
+
+
 GI_DATADIR=$($PKG_CONFIG --variable=gidatadir gobject-introspection-1.0)
 
 
@@ -14606,14 +14553,14 @@ if test -n "$PYCAIRO_CFLAGS"; then
     pkg_cv_PYCAIRO_CFLAGS="$PYCAIRO_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"py3cairo >= 1.10.0
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"py3cairo >= 1.11.1
         \""; } >&5
-  ($PKG_CONFIG --exists --print-errors "py3cairo >= 1.10.0
+  ($PKG_CONFIG --exists --print-errors "py3cairo >= 1.11.1
         ") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_PYCAIRO_CFLAGS=`$PKG_CONFIG --cflags "py3cairo >= 1.10.0
+  pkg_cv_PYCAIRO_CFLAGS=`$PKG_CONFIG --cflags "py3cairo >= 1.11.1
         " 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
@@ -14626,14 +14573,14 @@ if test -n "$PYCAIRO_LIBS"; then
     pkg_cv_PYCAIRO_LIBS="$PYCAIRO_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"py3cairo >= 1.10.0
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"py3cairo >= 1.11.1
         \""; } >&5
-  ($PKG_CONFIG --exists --print-errors "py3cairo >= 1.10.0
+  ($PKG_CONFIG --exists --print-errors "py3cairo >= 1.11.1
         ") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_PYCAIRO_LIBS=`$PKG_CONFIG --libs "py3cairo >= 1.10.0
+  pkg_cv_PYCAIRO_LIBS=`$PKG_CONFIG --libs "py3cairo >= 1.11.1
         " 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
@@ -14655,16 +14602,16 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "py3cairo >= 1.10.0
+               PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "py3cairo >= 1.11.1
         " 2>&1`
         else
-               PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "py3cairo >= 1.10.0
+               PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "py3cairo >= 1.11.1
         " 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
        echo "$PYCAIRO_PKG_ERRORS" >&5
 
-       as_fn_error $? "Package requirements (py3cairo >= 1.10.0
+       as_fn_error $? "Package requirements (py3cairo >= 1.11.1
         ) were not met:
 
 $PYCAIRO_PKG_ERRORS
@@ -14707,14 +14654,14 @@ if test -n "$PYCAIRO_CFLAGS"; then
     pkg_cv_PYCAIRO_CFLAGS="$PYCAIRO_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pycairo >= 1.2.0
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pycairo >= 1.11.1
         \""; } >&5
-  ($PKG_CONFIG --exists --print-errors "pycairo >= 1.2.0
+  ($PKG_CONFIG --exists --print-errors "pycairo >= 1.11.1
         ") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_PYCAIRO_CFLAGS=`$PKG_CONFIG --cflags "pycairo >= 1.2.0
+  pkg_cv_PYCAIRO_CFLAGS=`$PKG_CONFIG --cflags "pycairo >= 1.11.1
         " 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
@@ -14727,14 +14674,14 @@ if test -n "$PYCAIRO_LIBS"; then
     pkg_cv_PYCAIRO_LIBS="$PYCAIRO_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pycairo >= 1.2.0
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pycairo >= 1.11.1
         \""; } >&5
-  ($PKG_CONFIG --exists --print-errors "pycairo >= 1.2.0
+  ($PKG_CONFIG --exists --print-errors "pycairo >= 1.11.1
         ") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_PYCAIRO_LIBS=`$PKG_CONFIG --libs "pycairo >= 1.2.0
+  pkg_cv_PYCAIRO_LIBS=`$PKG_CONFIG --libs "pycairo >= 1.11.1
         " 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
@@ -14756,16 +14703,16 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pycairo >= 1.2.0
+               PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pycairo >= 1.11.1
         " 2>&1`
         else
-               PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pycairo >= 1.2.0
+               PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pycairo >= 1.11.1
         " 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
        echo "$PYCAIRO_PKG_ERRORS" >&5
 
-       as_fn_error $? "Package requirements (pycairo >= 1.2.0
+       as_fn_error $? "Package requirements (pycairo >= 1.11.1
         ) were not met:
 
 $PYCAIRO_PKG_ERRORS
@@ -14826,74 +14773,85 @@ else
 fi
 
 
-INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+# Disable -Werror always, see
+# https://mail.gnome.org/archives/desktop-devel-list/2017-April/msg00009.html
 
+    # C support is enabled by default.
 
 
+    # Only enable C++ support if AC_PROG_CXX is called. The redefinition of
+    # AC_PROG_CXX is so that a fatal error is emitted if this macro is called
+    # before AC_PROG_CXX, which would otherwise cause no C++ warnings to be
+    # checked.
 
-# compiler warnings, errors, required cflags, and code coverage support
 
 
+
+    # Default value for IS-RELEASE is $ax_is_release
+    ax_compiler_flags_is_release=yes
+
     # Check whether --enable-compile-warnings was given.
 if test "${enable_compile_warnings+set}" = set; then :
   enableval=$enable_compile_warnings;
 else
-  enable_compile_warnings="maximum"
+  if test "$ax_compiler_flags_is_release" = "yes"; then :
+  enable_compile_warnings="yes"
+else
+  enable_compile_warnings="error"
+fi
+fi
+
+    # Check whether --enable-Werror was given.
+if test "${enable_Werror+set}" = set; then :
+  enableval=$enable_Werror;
+else
+  enable_Werror=maybe
 fi
 
 
-    if test "x$GCC" != xyes; then
-       enable_compile_warnings=no
-    fi
+    # Return the user's chosen warning level
+    if test "$enable_Werror" = "no" -a \
+                "$enable_compile_warnings" = "error"; then :
+
+        enable_compile_warnings="yes"
+
+fi
+
+    ax_enable_compile_warnings=$enable_compile_warnings
+
 
-    warning_flags=
-    realsave_CFLAGS="$CFLAGS"
-
-            base_warn_flags=" \
-        -Wall \
-        -Wstrict-prototypes \
-        -Wnested-externs \
-    "
-
-                    base_error_flags=" \
-        -Werror=missing-prototypes \
-        -Werror=implicit-function-declaration \
-        -Werror=pointer-arith \
-        -Werror=init-self \
-        -Werror=format-security \
-        -Werror=format=2 \
-        -Werror=missing-include-dirs \
-        -Werror=return-type \
-    "
-
-                additional_flags="-Wno-error=missing-prototypes"
-
-    case "$enable_compile_warnings" in
-    no)
-        warning_flags="-w"
-        ;;
-    minimum)
-        warning_flags="-Wall"
-        ;;
-    yes|maximum|error)
-        warning_flags="$base_warn_flags $base_error_flags $additional_flags"
-        ;;
-    *)
-        as_fn_error $? "Unknown argument '$enable_compile_warnings' to --enable-compile-warnings" "$LINENO" 5
-        ;;
-    esac
 
-    if test "$enable_compile_warnings" = "error" ; then
-        warning_flags="$warning_flags -Werror"
-    fi
 
-        for option in $warning_flags; do
-       save_CFLAGS="$CFLAGS"
-       CFLAGS="$CFLAGS $option"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands $option" >&5
-$as_echo_n "checking whether gcc understands $option... " >&6; }
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+
+
+
+
+
+    # Variable names
+
+
+    ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+    # Always pass -Werror=unknown-warning-option to get Clang to fail on bad
+    # flags, otherwise they are always appended to the warn_cflags variable, and
+    # Clang warns on them for every compilation unit.
+    # If this is passed to GCC, it will explode, so the flag must be enabled
+    # conditionally.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=unknown-warning-option" >&5
+$as_echo_n "checking whether C compiler accepts -Werror=unknown-warning-option... " >&6; }
+if ${ax_cv_check_cflags___Werror_unknown_warning_option+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS  -Werror=unknown-warning-option"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -14905,106 +14863,1151 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  has_option=yes
+  ax_cv_check_cflags___Werror_unknown_warning_option=yes
 else
-  has_option=no
+  ax_cv_check_cflags___Werror_unknown_warning_option=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       CFLAGS="$save_CFLAGS"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_option" >&5
-$as_echo "$has_option" >&6; }
-       if test $has_option = yes; then
-           tested_warning_flags="$tested_warning_flags $option"
-       fi
-       unset has_option
-       unset save_CFLAGS
-    done
-    unset option
-    CFLAGS="$realsave_CFLAGS"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking what warning flags to pass to the C compiler" >&5
-$as_echo_n "checking what warning flags to pass to the C compiler... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tested_warning_flags" >&5
-$as_echo "$tested_warning_flags" >&6; }
+  CFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Werror_unknown_warning_option" >&5
+$as_echo "$ax_cv_check_cflags___Werror_unknown_warning_option" >&6; }
+if test "x$ax_cv_check_cflags___Werror_unknown_warning_option" = xyes; then :
+
+        ax_compiler_flags_test="-Werror=unknown-warning-option"
 
-    # Check whether --enable-iso-c was given.
-if test "${enable_iso_c+set}" = set; then :
-  enableval=$enable_iso_c;
 else
-  enable_iso_c=no
-fi
 
+        ax_compiler_flags_test=""
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking what language compliance flags to pass to the C compiler" >&5
-$as_echo_n "checking what language compliance flags to pass to the C compiler... " >&6; }
-    complCFLAGS=
-    if test "x$enable_iso_c" != "xno"; then
-       if test "x$GCC" = "xyes"; then
-       case " $CFLAGS " in
-           *\ \        -ansi\ \        *) ;;
-           *) complCFLAGS="$complCFLAGS -ansi" ;;
-       esac
-       case " $CFLAGS " in
-           *\ \        -pedantic\ \    *) ;;
-           *) complCFLAGS="$complCFLAGS -pedantic" ;;
-       esac
-       fi
-    fi
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $complCFLAGS" >&5
-$as_echo "$complCFLAGS" >&6; }
+fi
 
-    WARN_CFLAGS="$tested_warning_flags $complCFLAGS"
 
+    # Base flags
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gnome code coverage support" >&5
-$as_echo_n "checking for Gnome code coverage support... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
 
 
 
+for flag in          -fno-strict-aliasing              ; do
+  as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5
+$as_echo_n "checking whether C compiler accepts $flag... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS $ax_compiler_flags_test $flag"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-       # allow to override gcov location
+int
+main ()
+{
 
-# Check whether --with-gcov was given.
-if test "${with_gcov+set}" = set; then :
-  withval=$with_gcov; _AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
 else
-  _AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov
+  eval "$as_CACHEVAR=no"
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
 
+if ${WARN_CFLAGS+:} false; then :
+
+  case " $WARN_CFLAGS " in #(
+  *" $flag "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5
+  (: WARN_CFLAGS already contains $flag) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_CFLAGS " $flag"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
 
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with code coverage support" >&5
-$as_echo_n "checking whether to build with code coverage support... " >&6; }
-       # Check whether --enable-code-coverage was given.
-if test "${enable_code_coverage+set}" = set; then :
-  enableval=$enable_code_coverage;
 else
-  enable_code_coverage=no
-fi
 
+  WARN_CFLAGS=$flag
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
 
-        if test x$enable_code_coverage = xyes; then
-  CODE_COVERAGE_ENABLED_TRUE=
-  CODE_COVERAGE_ENABLED_FALSE='#'
 else
-  CODE_COVERAGE_ENABLED_TRUE='#'
-  CODE_COVERAGE_ENABLED_FALSE=
+  :
 fi
 
-       CODE_COVERAGE_ENABLED=$enable_code_coverage
+done
 
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_code_coverage" >&5
-$as_echo "$enable_code_coverage" >&6; }
 
-       if  test "$enable_code_coverage" = "yes" ; then :
+    if test "$ax_enable_compile_warnings" != "no"; then :
 
-               # check for gcov
-               if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH", so it can be a program name with args.
-set dummy ${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_GCOV+:} false; then :
+        # "yes" flags
+
+
+
+
+for flag in              -Wall             -Wextra             -Wundef             -Wnested-externs             -Wwrite-strings             -Wpointer-arith             -Wmissing-declarations             -Wmissing-prototypes             -Wstrict-prototypes             -Wredundant-decls             -Wno-unused-parameter             -Wno-missing-field-initializers             -Wdeclaration-after-statement             -Wformat=2             -Wold-style-definition             -Wcast-align             -Wformat-nonliteral             -Wformat-security             -Wsign-compare             -Wstrict-aliasing             -Wshadow             -Winline             -Wpacked             -Wmissing-format-attribute             -Wmissing-noreturn             -Winit-self             -Wredundant-decls             -Wmissing-include-dirs             -Wunused-but-set-variable             -Warray-bounds             -Wimplicit-function-declaration             -Wreturn-type             -Wswitch-enum             -Wswitch-default                                                                ; do
+  as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5
+$as_echo_n "checking whether C compiler accepts $flag... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS $ax_compiler_flags_test $flag"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
+else
+  eval "$as_CACHEVAR=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
+
+if ${WARN_CFLAGS+:} false; then :
+
+  case " $WARN_CFLAGS " in #(
+  *" $flag "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5
+  (: WARN_CFLAGS already contains $flag) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_CFLAGS " $flag"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_CFLAGS=$flag
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+else
+  :
+fi
+
+done
+
+
+fi
+    if test "$ax_enable_compile_warnings" = "error"; then :
+
+        # "error" flags; -Werror has to be appended unconditionally because
+        # it's not possible to test for
+        #
+        # suggest-attribute=format is disabled because it gives too many false
+        # positives
+
+if ${WARN_CFLAGS+:} false; then :
+
+  case " $WARN_CFLAGS " in #(
+  *" -Werror "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains -Werror"; } >&5
+  (: WARN_CFLAGS already contains -Werror) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_CFLAGS " -Werror"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_CFLAGS=-Werror
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+
+
+
+
+
+for flag in              -Wno-suggest-attribute=format         ; do
+  as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5
+$as_echo_n "checking whether C compiler accepts $flag... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS $ax_compiler_flags_test $flag"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
+else
+  eval "$as_CACHEVAR=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
+
+if ${WARN_CFLAGS+:} false; then :
+
+  case " $WARN_CFLAGS " in #(
+  *" $flag "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5
+  (: WARN_CFLAGS already contains $flag) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_CFLAGS " $flag"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_CFLAGS=$flag
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+else
+  :
+fi
+
+done
+
+
+fi
+
+    # In the flags below, when disabling specific flags, always add *both*
+    # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
+    # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall,
+    # which effectively turns that flag back on again as an error.
+    for flag in $WARN_CFLAGS; do
+        case $flag in #(
+  -Wno-*=*) :
+     ;; #(
+  -Wno-*) :
+
+
+
+
+
+for flag in -Wno-error=$($as_echo $flag | $SED 's/^-Wno-//'); do
+  as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5
+$as_echo_n "checking whether C compiler accepts $flag... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS $ax_compiler_flags_test $flag"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
+else
+  eval "$as_CACHEVAR=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
+
+if ${WARN_CFLAGS+:} false; then :
+
+  case " $WARN_CFLAGS " in #(
+  *" $flag "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5
+  (: WARN_CFLAGS already contains $flag) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_CFLAGS " $flag"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_CFLAGS=$flag
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5
+  (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+else
+  :
+fi
+
+done
+
+                 ;; #(
+  *) :
+     ;;
+esac
+    done
+
+    ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+    # Substitute the variables
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # Variable names
+
+
+    # Always pass -Werror=unknown-warning-option to get Clang to fail on bad
+    # flags, otherwise they are always appended to the warn_ldflags variable,
+    # and Clang warns on them for every compilation unit.
+    # If this is passed to GCC, it will explode, so the flag must be enabled
+    # conditionally.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=unknown-warning-option" >&5
+$as_echo_n "checking whether C compiler accepts -Werror=unknown-warning-option... " >&6; }
+if ${ax_cv_check_cflags___Werror_unknown_warning_option+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS  -Werror=unknown-warning-option"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ax_cv_check_cflags___Werror_unknown_warning_option=yes
+else
+  ax_cv_check_cflags___Werror_unknown_warning_option=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Werror_unknown_warning_option" >&5
+$as_echo "$ax_cv_check_cflags___Werror_unknown_warning_option" >&6; }
+if test "x$ax_cv_check_cflags___Werror_unknown_warning_option" = xyes; then :
+
+        ax_compiler_flags_test="-Werror=unknown-warning-option"
+
+else
+
+        ax_compiler_flags_test=""
+
+fi
+
+
+    # macOS linker does not have --as-needed
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,--no-as-needed" >&5
+$as_echo_n "checking whether the linker accepts -Wl,--no-as-needed... " >&6; }
+if ${ax_cv_check_ldflags___Wl___no_as_needed+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$LDFLAGS
+  LDFLAGS="$LDFLAGS  -Wl,--no-as-needed"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ax_cv_check_ldflags___Wl___no_as_needed=yes
+else
+  ax_cv_check_ldflags___Wl___no_as_needed=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___Wl___no_as_needed" >&5
+$as_echo "$ax_cv_check_ldflags___Wl___no_as_needed" >&6; }
+if test "x$ax_cv_check_ldflags___Wl___no_as_needed" = xyes; then :
+
+        ax_compiler_flags_as_needed_option="-Wl,--no-as-needed"
+
+else
+
+        ax_compiler_flags_as_needed_option=""
+
+fi
+
+
+    # macOS linker speaks with a different accent
+    ax_compiler_flags_fatal_warnings_option=""
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,--fatal-warnings" >&5
+$as_echo_n "checking whether the linker accepts -Wl,--fatal-warnings... " >&6; }
+if ${ax_cv_check_ldflags___Wl___fatal_warnings+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$LDFLAGS
+  LDFLAGS="$LDFLAGS  -Wl,--fatal-warnings"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ax_cv_check_ldflags___Wl___fatal_warnings=yes
+else
+  ax_cv_check_ldflags___Wl___fatal_warnings=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___Wl___fatal_warnings" >&5
+$as_echo "$ax_cv_check_ldflags___Wl___fatal_warnings" >&6; }
+if test "x$ax_cv_check_ldflags___Wl___fatal_warnings" = xyes; then :
+
+        ax_compiler_flags_fatal_warnings_option="-Wl,--fatal-warnings"
+
+else
+  :
+fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-fatal_warnings" >&5
+$as_echo_n "checking whether the linker accepts -Wl,-fatal_warnings... " >&6; }
+if ${ax_cv_check_ldflags___Wl__fatal_warnings+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$LDFLAGS
+  LDFLAGS="$LDFLAGS  -Wl,-fatal_warnings"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ax_cv_check_ldflags___Wl__fatal_warnings=yes
+else
+  ax_cv_check_ldflags___Wl__fatal_warnings=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___Wl__fatal_warnings" >&5
+$as_echo "$ax_cv_check_ldflags___Wl__fatal_warnings" >&6; }
+if test "x$ax_cv_check_ldflags___Wl__fatal_warnings" = xyes; then :
+
+        ax_compiler_flags_fatal_warnings_option="-Wl,-fatal_warnings"
+
+else
+  :
+fi
+
+
+    # Base flags
+
+
+
+
+for flag in          $ax_compiler_flags_as_needed_option              ; do
+  as_CACHEVAR=`$as_echo "ax_cv_check_ldflags_$ax_compiler_flags_test_$flag" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts $flag" >&5
+$as_echo_n "checking whether the linker accepts $flag... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$LDFLAGS
+  LDFLAGS="$LDFLAGS $ax_compiler_flags_test $flag"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
+else
+  eval "$as_CACHEVAR=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
+
+if ${WARN_LDFLAGS+:} false; then :
+
+  case " $WARN_LDFLAGS " in #(
+  *" $flag "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_LDFLAGS already contains \$flag"; } >&5
+  (: WARN_LDFLAGS already contains $flag) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_LDFLAGS " $flag"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_LDFLAGS=\"\$WARN_LDFLAGS\""; } >&5
+  (: WARN_LDFLAGS="$WARN_LDFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_LDFLAGS=$flag
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_LDFLAGS=\"\$WARN_LDFLAGS\""; } >&5
+  (: WARN_LDFLAGS="$WARN_LDFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+else
+  :
+fi
+
+done
+
+
+    if test "$ax_enable_compile_warnings" != "no"; then :
+
+        # "yes" flags
+
+
+
+
+for flag in       ; do
+  as_CACHEVAR=`$as_echo "ax_cv_check_ldflags_$ax_compiler_flags_test_$flag" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts $flag" >&5
+$as_echo_n "checking whether the linker accepts $flag... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$LDFLAGS
+  LDFLAGS="$LDFLAGS $ax_compiler_flags_test $flag"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
+else
+  eval "$as_CACHEVAR=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
+
+if ${WARN_LDFLAGS+:} false; then :
+
+  case " $WARN_LDFLAGS " in #(
+  *" $flag "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_LDFLAGS already contains \$flag"; } >&5
+  (: WARN_LDFLAGS already contains $flag) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_LDFLAGS " $flag"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_LDFLAGS=\"\$WARN_LDFLAGS\""; } >&5
+  (: WARN_LDFLAGS="$WARN_LDFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_LDFLAGS=$flag
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_LDFLAGS=\"\$WARN_LDFLAGS\""; } >&5
+  (: WARN_LDFLAGS="$WARN_LDFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+else
+  :
+fi
+
+done
+
+
+fi
+    if test "$ax_enable_compile_warnings" = "error"; then :
+
+        # "error" flags; -Werror has to be appended unconditionally because
+        # it's not possible to test for
+        #
+        # suggest-attribute=format is disabled because it gives too many false
+        # positives
+
+
+
+
+for flag in              $ax_compiler_flags_fatal_warnings_option         ; do
+  as_CACHEVAR=`$as_echo "ax_cv_check_ldflags_$ax_compiler_flags_test_$flag" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts $flag" >&5
+$as_echo_n "checking whether the linker accepts $flag... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$LDFLAGS
+  LDFLAGS="$LDFLAGS $ax_compiler_flags_test $flag"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
+else
+  eval "$as_CACHEVAR=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
+
+if ${WARN_LDFLAGS+:} false; then :
+
+  case " $WARN_LDFLAGS " in #(
+  *" $flag "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_LDFLAGS already contains \$flag"; } >&5
+  (: WARN_LDFLAGS already contains $flag) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_LDFLAGS " $flag"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_LDFLAGS=\"\$WARN_LDFLAGS\""; } >&5
+  (: WARN_LDFLAGS="$WARN_LDFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_LDFLAGS=$flag
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_LDFLAGS=\"\$WARN_LDFLAGS\""; } >&5
+  (: WARN_LDFLAGS="$WARN_LDFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+else
+  :
+fi
+
+done
+
+
+fi
+
+    # Substitute the variables
+
+
+
+
+
+
+    # Variable names
+
+
+    # Base flags
+
+if ${WARN_SCANNERFLAGS+:} false; then :
+
+  case " $WARN_SCANNERFLAGS " in #(
+  *"  "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_SCANNERFLAGS already contains "; } >&5
+  (: WARN_SCANNERFLAGS already contains ) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_SCANNERFLAGS " "
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_SCANNERFLAGS=\"\$WARN_SCANNERFLAGS\""; } >&5
+  (: WARN_SCANNERFLAGS="$WARN_SCANNERFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_SCANNERFLAGS=
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_SCANNERFLAGS=\"\$WARN_SCANNERFLAGS\""; } >&5
+  (: WARN_SCANNERFLAGS="$WARN_SCANNERFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+
+    if test "$ax_enable_compile_warnings" != "no"; then :
+
+        # "yes" flags
+
+if ${WARN_SCANNERFLAGS+:} false; then :
+
+  case " $WARN_SCANNERFLAGS " in #(
+  *"              --warn-all                                                              "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_SCANNERFLAGS already contains              --warn-all                                                             "; } >&5
+  (: WARN_SCANNERFLAGS already contains              --warn-all                                                             ) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_SCANNERFLAGS "              --warn-all                                                             "
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_SCANNERFLAGS=\"\$WARN_SCANNERFLAGS\""; } >&5
+  (: WARN_SCANNERFLAGS="$WARN_SCANNERFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_SCANNERFLAGS=             --warn-all
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_SCANNERFLAGS=\"\$WARN_SCANNERFLAGS\""; } >&5
+  (: WARN_SCANNERFLAGS="$WARN_SCANNERFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+
+fi
+    if test "$ax_enable_compile_warnings" = "error"; then :
+
+        # "error" flags
+
+if ${WARN_SCANNERFLAGS+:} false; then :
+
+  case " $WARN_SCANNERFLAGS " in #(
+  *"              --warn-error          "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_SCANNERFLAGS already contains              --warn-error         "; } >&5
+  (: WARN_SCANNERFLAGS already contains              --warn-error         ) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append WARN_SCANNERFLAGS "              --warn-error         "
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_SCANNERFLAGS=\"\$WARN_SCANNERFLAGS\""; } >&5
+  (: WARN_SCANNERFLAGS="$WARN_SCANNERFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  WARN_SCANNERFLAGS=             --warn-error
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : WARN_SCANNERFLAGS=\"\$WARN_SCANNERFLAGS\""; } >&5
+  (: WARN_SCANNERFLAGS="$WARN_SCANNERFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+
+fi
+
+    # Substitute the variables
+
+
+
+# Disable some warnings, either because they get generated by headers of
+# dependencies we don't control or because it was hard to fix them.
+# Feel free and try to get rid of them.
+# For clang only:
+
+
+
+
+for flag in -Wno-unknown-warning-option -Wno-incompatible-pointer-types-discards-qualifiers -Wno-cast-align; do
+  as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5
+$as_echo_n "checking whether C compiler accepts $flag... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS  $flag"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
+else
+  eval "$as_CACHEVAR=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
+
+if ${CFLAGS+:} false; then :
+
+  case " $CFLAGS " in #(
+  *" $flag "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5
+  (: CFLAGS already contains $flag) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append CFLAGS " $flag"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
+  (: CFLAGS="$CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  CFLAGS=$flag
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
+  (: CFLAGS="$CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+else
+  :
+fi
+
+done
+
+# For gcc + clang:
+
+
+
+
+for flag in -Wno-discarded-qualifiers -Wno-redundant-decls -Wno-switch-enum -Wno-undef; do
+  as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5
+$as_echo_n "checking whether C compiler accepts $flag... " >&6; }
+if eval \${$as_CACHEVAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CFLAGS
+  CFLAGS="$CFLAGS  $flag"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_CACHEVAR=yes"
+else
+  eval "$as_CACHEVAR=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS=$ax_check_save_flags
+fi
+eval ac_res=\$$as_CACHEVAR
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
+
+if ${CFLAGS+:} false; then :
+
+  case " $CFLAGS " in #(
+  *" $flag "*) :
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5
+  (: CFLAGS already contains $flag) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+     as_fn_append CFLAGS " $flag"
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
+  (: CFLAGS="$CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+     ;;
+esac
+
+else
+
+  CFLAGS=$flag
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5
+  (: CFLAGS="$CFLAGS") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+
+fi
+
+else
+  :
+fi
+
+done
+
+
+
+
+
+       # allow to override gcov location
+
+# Check whether --with-gcov was given.
+if test "${with_gcov+set}" = set; then :
+  withval=$with_gcov; _AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov
+else
+  _AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov
+fi
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with code coverage support" >&5
+$as_echo_n "checking whether to build with code coverage support... " >&6; }
+       # Check whether --enable-code-coverage was given.
+if test "${enable_code_coverage+set}" = set; then :
+  enableval=$enable_code_coverage;
+else
+  enable_code_coverage=no
+fi
+
+
+        if test x$enable_code_coverage = xyes; then
+  CODE_COVERAGE_ENABLED_TRUE=
+  CODE_COVERAGE_ENABLED_FALSE='#'
+else
+  CODE_COVERAGE_ENABLED_TRUE='#'
+  CODE_COVERAGE_ENABLED_FALSE=
+fi
+
+       CODE_COVERAGE_ENABLED=$enable_code_coverage
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_code_coverage" >&5
+$as_echo "$enable_code_coverage" >&6; }
+
+       if  test "$enable_code_coverage" = "yes" ; then :
+
+               # check for gcov
+               if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH", so it can be a program name with args.
+set dummy ${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_GCOV+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$GCOV"; then
@@ -15102,9 +16105,6 @@ fi
 
 fi
 
-               # List of supported lcov versions.
-               lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12"
-
                # Extract the first word of "lcov", so it can be a program name with args.
 set dummy lcov; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 
 
 
-               if  test "$LCOV" ; then :
-
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lcov version" >&5
-$as_echo_n "checking for lcov version... " >&6; }
-if ${ax_cv_lcov_version+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-                               ax_cv_lcov_version=invalid
-                               lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
-                               for lcov_check_version in $lcov_version_list; do
-                                       if test "$lcov_version" = "$lcov_check_version"; then
-                                               ax_cv_lcov_version="$lcov_check_version (ok)"
-                                       fi
-                               done
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_lcov_version" >&5
-$as_echo "$ax_cv_lcov_version" >&6; }
-
-else
+               if  test -z "$LCOV" ; then :
 
-                       lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
-                       as_fn_error $? "$lcov_msg" "$LINENO" 5
+                       as_fn_error $? "To enable code coverage reporting you must have lcov installed" "$LINENO" 5
 
 fi
 
-               case $ax_cv_lcov_version in
-                       ""|invalid)
-                               lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
-                               as_fn_error $? "$lcov_msg" "$LINENO" 5
-                               LCOV="exit 0;"
-                       ;;
-               esac
-
                if  test -z "$GENHTML" ; then :
 
                        as_fn_error $? "Could not find genhtml from the lcov package" "$LINENO" 5
@@ -15224,7 +16195,7 @@ fi
                                                CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
                CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
                CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
-               CODE_COVERAGE_LDFLAGS="-lgcov"
+               CODE_COVERAGE_LIBS="-lgcov"
                CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
 
 
 
 
 
+               CODE_COVERAGE_RULES_CHECK='
+       -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
+       $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
+'
+               CODE_COVERAGE_RULES_CAPTURE='
+       $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
+       $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
+       -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
+       $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
+       @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
+'
+               CODE_COVERAGE_RULES_CLEAN='
+clean: code-coverage-clean
+distclean: code-coverage-clean
+code-coverage-clean:
+       -$(LCOV) --directory $(top_builddir) -z
+       -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
+       -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
+'
+
+else
+
+               CODE_COVERAGE_RULES_CHECK='
+       @echo "Need to reconfigure with --enable-code-coverage"
+'
+               CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK"
+               CODE_COVERAGE_RULES_CLEAN=''
+
 fi
 
 CODE_COVERAGE_RULES='
@@ -15312,37 +16311,15 @@ code_coverage_quiet_0 = --quiet
 code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
 
 # Use recursive makes in order to ignore errors during check
-check-code-coverage:
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-       -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
-       $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
-else
-       @echo "Need to reconfigure with --enable-code-coverage"
-endif
+check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"'
 
 # Capture code coverage data
-code-coverage-capture: code-coverage-capture-hook
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-       $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
-       $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
-       -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
-       $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
-       @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
-else
-       @echo "Need to reconfigure with --enable-code-coverage"
-endif
+code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"'
 
 # Hook rule executed before code-coverage-capture, overridable by the user
 code-coverage-capture-hook:
 
-ifeq ($(CODE_COVERAGE_ENABLED),yes)
-clean: code-coverage-clean
-distclean: code-coverage-clean
-code-coverage-clean:
-       -$(LCOV) --directory $(top_builddir) -z
-       -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-       -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
-endif
+'"$CODE_COVERAGE_RULES_CLEAN"'
 
 GITIGNOREFILES ?=
 GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
@@ -15356,151 +16333,8 @@ A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
 
 
 
-       GNOME_CODE_COVERAGE_RULES=$CODE_COVERAGE_RULES
-
-
-
-
-
-if test "x$GCC" = "xyes"; then
-
-case " $CFLAGS " in
-*[\    \ ]-Wall[\      \ ]*)
-  ;;
-*)
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -Wall"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -Wall" >&5
-$as_echo_n "checking whether $CC understands -Wall... " >&6; }
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  jh_has_option=yes
-else
-  jh_has_option=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $jh_has_option" >&5
-$as_echo "$jh_has_option" >&6; }
-  if test $jh_has_option = no; then
-    CFLAGS="$save_CFLAGS"
-  fi
-  ;;
-esac
-
-case " $CFLAGS " in
-*[\    \ ]-Werror=unused-variable[\    \ ]*)
-  ;;
-*)
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -Werror=unused-variable"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -Werror=unused-variable" >&5
-$as_echo_n "checking whether $CC understands -Werror=unused-variable... " >&6; }
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  jh_has_option=yes
-else
-  jh_has_option=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $jh_has_option" >&5
-$as_echo "$jh_has_option" >&6; }
-  if test $jh_has_option = no; then
-    CFLAGS="$save_CFLAGS"
-  fi
-  ;;
-esac
-
-case " $CFLAGS " in
-*[\    \ ]-fno-strict-aliasing[\       \ ]*)
-  ;;
-*)
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -fno-strict-aliasing"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -fno-strict-aliasing" >&5
-$as_echo_n "checking whether $CC understands -fno-strict-aliasing... " >&6; }
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  jh_has_option=yes
-else
-  jh_has_option=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $jh_has_option" >&5
-$as_echo "$jh_has_option" >&6; }
-  if test $jh_has_option = no; then
-    CFLAGS="$save_CFLAGS"
-  fi
-  ;;
-esac
-
-case " $CFLAGS " in
-*[\    \ ]-Werror=declaration-after-statement[\        \ ]*)
-  ;;
-*)
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -Werror=declaration-after-statement"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -Werror=declaration-after-statement" >&5
-$as_echo_n "checking whether $CC understands -Werror=declaration-after-statement... " >&6; }
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  jh_has_option=yes
-else
-  jh_has_option=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $jh_has_option" >&5
-$as_echo "$jh_has_option" >&6; }
-  if test $jh_has_option = no; then
-    CFLAGS="$save_CFLAGS"
-  fi
-  ;;
-esac
-fi
-
-CFLAGS="$CFLAGS $WARN_CFLAGS $CODE_COVERAGE_CFLAGS"
-LDFLAGS="$LDFLAGS $CODE_COVERAGE_CFLAGS"
 
-ac_config_files="$ac_config_files Makefile pygobject-3.0.pc pygobject-3.0-uninstalled.pc gi/Makefile gi/repository/Makefile gi/overrides/Makefile gi/_gobject/Makefile examples/Makefile tests/Makefile pygtkcompat/Makefile PKG-INFO"
+ac_config_files="$ac_config_files Makefile pygobject-3.0.pc pygobject-3.0-uninstalled.pc gi/Makefile gi/repository/Makefile gi/overrides/Makefile examples/Makefile tests/Makefile pygtkcompat/Makefile PKG-INFO"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -15643,6 +16477,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${ENABLE_CAIRO_TRUE}" && test -z "${ENABLE_CAIRO_FALSE}"; then
   as_fn_error $? "conditional \"ENABLE_CAIRO\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -16052,7 +16890,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by pygobject $as_me 3.24.1, which was
+This file was extended by pygobject $as_me 3.25.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16119,7 +16957,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-pygobject config.status 3.24.1
+pygobject config.status 3.25.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -16542,7 +17380,6 @@ do
     "gi/Makefile") CONFIG_FILES="$CONFIG_FILES gi/Makefile" ;;
     "gi/repository/Makefile") CONFIG_FILES="$CONFIG_FILES gi/repository/Makefile" ;;
     "gi/overrides/Makefile") CONFIG_FILES="$CONFIG_FILES gi/overrides/Makefile" ;;
-    "gi/_gobject/Makefile") CONFIG_FILES="$CONFIG_FILES gi/_gobject/Makefile" ;;
     "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
     "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
     "pygtkcompat/Makefile") CONFIG_FILES="$CONFIG_FILES pygtkcompat/Makefile" ;;
 { $as_echo "$as_me:${as_lineno-$LINENO}: result:
        pygobject $VERSION
 
+       Is release:                     $ax_is_release
        Using python interpreter:       $PYTHON
        cairo support:                  $enable_cairo
-       thread support:                 $enable_thread
        code coverage support:          $enable_code_coverage
 " >&5
 $as_echo "
        pygobject $VERSION
 
+       Is release:                     $ax_is_release
        Using python interpreter:       $PYTHON
        cairo support:                  $enable_cairo
-       thread support:                 $enable_thread
        code coverage support:          $enable_code_coverage
 " >&6; }
 
index 71ff9dc..68351ca 100644 (file)
@@ -13,25 +13,24 @@ AC_PREREQ([2.68])
 #   $ ./configure --with-python=~/my-patched-python/python
 
 m4_define(python_min_ver, 2.7)
-m4_define(python3_min_ver, 3.1)
+m4_define(python3_min_ver, 3.3)
 
 dnl the pygobject version number
 m4_define(pygobject_major_version, 3)
-m4_define(pygobject_minor_version, 24)
+m4_define(pygobject_minor_version, 25)
 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.46.0)
-m4_define(py2cairo_required_version, 1.2.0)
-m4_define(py3cairo_required_version, 1.10.0)
+m4_define(pycairo_required_version, 1.11.1)
 m4_define(glib_required_version, 2.38.0)
 m4_define(gio_required_version, 2.38.0)
 
 AC_INIT([pygobject],[pygobject_version],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject],
        [pygobject],[https://wiki.gnome.org/Projects/PyGObject/])
-AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .")
+AX_IS_RELEASE([minor-version])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([gi/gimodule.c])
 
@@ -44,16 +43,11 @@ AC_SUBST(PYGOBJECT_MICRO_VERSION, pygobject_micro_version)
 
 AC_CONFIG_HEADERS(config.h)
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
-# 1.12.6 to get a py-compile supporting newer Python 3 versions.
-# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=8847
-AM_INIT_AUTOMAKE([1.12.6 foreign no-dist-gzip dist-xz])
-
-dnl put the ACLOCAL flags in the makefile
-ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
+AM_INIT_AUTOMAKE([1.13 foreign no-dist-gzip dist-xz])
 
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
-AC_MSG_CHECKING([for build time linking with Python (Darwin and Win32)])
+AC_MSG_CHECKING([for build time linking with Python (Win32)])
 case "$host" in
   *-*-mingw*|*-*-cygwin*)
     os_win32=yes
@@ -62,7 +56,7 @@ case "$host" in
     ;;
   *-*-darwin*)
     os_win32=no
-    link_python_libs=yes
+    link_python_libs=no
     OS_EXT=dylib
     ;;
   *)
@@ -119,49 +113,11 @@ fi
 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]))
+PYG_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found]))
 if test "x$link_python_libs" = "xyes"; then
-  AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows and Darwin require Python modules to be explicitly linked to libpython.]))
+  PYG_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.]))
 fi
 
-AC_MSG_CHECKING([for PySignal_SetWakeupFd in Python.h])
-old_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="-Wall -Werror $PYTHON_INCLUDES"
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[PySignal_SetWakeupFd(0);]])],
-                  [setwakeupfd_ok=yes],[setwakeupfd_ok=no])
-AC_MSG_RESULT($setwakeupfd_ok)
-if test "x$setwakeupfd_ok" != xno; then
-  AC_DEFINE(HAVE_PYSIGNAL_SETWAKEUPFD, 1,
-                [Define to 1 if PySignal_SetWakeupFd is available])
-fi
-CPPFLAGS=$old_CPPFLAGS
-
-PLATFORM=`$PYTHON -c "import sys; from distutils import util; sys.stdout.write(util.get_platform())"`
-AC_SUBST(PLATFORM)
-
-AC_ARG_ENABLE(thread,
-  AS_HELP_STRING([--disable-thread],[Disable pygobject threading support]),,
-  enable_thread=yes)
-
-AM_CHECK_PYMOD(thread,,,enable_thread=check_for_py3_module)
-if test "x$enable_thread" = xcheck_for_py3_module; then
-  dnl Python 3 uses the _thread module so check for that
-  AM_CHECK_PYMOD(_thread,,enable_thread=yes,enable_thread=no)
-fi
-
-AC_MSG_CHECKING(whether to enable threading in pygobject)
-if test "x$enable_thread" != xno; then
-  extra_mods=gthread
-  THREADING_CFLAGS=
-  AC_MSG_RESULT(yes)
-else
-  extra_mods=
-  THREADING_CFLAGS="-DDISABLE_THREADING"
-  AC_MSG_RESULT(no)
-fi
-AC_SUBST(THREADING_CFLAGS)
-CPPFLAGS="${CPPFLAGS} $THREADING_CFLAGS"
-
 dnl get rid of the -export-dynamic stuff from the configure flags ...
 export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
 
@@ -170,10 +126,9 @@ AM_PATH_GLIB_2_0(glib_required_version,,[AC_MSG_ERROR(maybe you want the pygobje
 if test -n "$export_dynamic"; then
   GLIB_LIBS=`echo $GLIB_LIBS | sed -e "s/$export_dynamic//"`
 fi
-PYTHON_BASENAME=`basename $PYTHON`
-AC_SUBST([PYTHON_BASENAME])
 
-AS_AC_EXPAND(DATADIR, $datadir)
+PYTHON_VALGRIND_SUPP=`$PYTHON -c "import sys; sys.stdout.write('python' + sys.version.__getitem__(0))"`
+AC_SUBST([PYTHON_VALGRIND_SUPP])
 
 dnl libffi
 PKG_CHECK_MODULES(FFI, libffi >= 3.0)
@@ -196,6 +151,8 @@ PKG_CHECK_MODULES(GI,
     gobject-introspection-1.0 >= introspection_required_version
 )
 
+GOBJECT_INTROSPECTION_CHECK(introspection_required_version)
+
 GI_DATADIR=$($PKG_CONFIG --variable=gidatadir gobject-introspection-1.0)
 AC_SUBST(GI_DATADIR)
 
@@ -204,11 +161,11 @@ if test "$enable_cairo" != no; then
 
     if test $build_py3k = true; then
         PKG_CHECK_MODULES(PYCAIRO,
-            py3cairo >= py3cairo_required_version
+            py3cairo >= pycairo_required_version
         )
     else
         PKG_CHECK_MODULES(PYCAIRO,
-            pycairo >= py2cairo_required_version
+            pycairo >= pycairo_required_version
         )
     fi
 fi
@@ -221,32 +178,18 @@ AC_ARG_WITH(common,
     with_common=yes)
 AM_CONDITIONAL(WITH_COMMON, test "$with_common" = "yes")
 
-INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
-
-AC_SUBST(INTROSPECTION_SCANNER)
-AC_SUBST(INTROSPECTION_COMPILER)
-
-# compiler warnings, errors, required cflags, and code coverage support
-GNOME_COMPILE_WARNINGS([maximum], [-Wno-error=missing-prototypes])
-AC_MSG_CHECKING(for Gnome code coverage support)
-m4_ifdef([GNOME_CODE_COVERAGE],
-         [AC_MSG_RESULT(yes)
-          GNOME_CODE_COVERAGE],
-         [AC_MSG_RESULT(no)
-          GNOME_CODE_COVERAGE_RULES=''
-          AC_SUBST([GNOME_CODE_COVERAGE_RULES])
-          enable_code_coverage="no"])
-
-if test "x$GCC" = "xyes"; then
-  JH_ADD_CFLAG([-Wall])
-  JH_ADD_CFLAG([-Werror=unused-variable])
-  JH_ADD_CFLAG([-fno-strict-aliasing])
-  JH_ADD_CFLAG([-Werror=declaration-after-statement])
-fi
+# Disable -Werror always, see
+# https://mail.gnome.org/archives/desktop-devel-list/2017-April/msg00009.html
+AX_COMPILER_FLAGS(,, [yes])
+# Disable some warnings, either because they get generated by headers of
+# dependencies we don't control or because it was hard to fix them.
+# Feel free and try to get rid of them.
+# For clang only:
+AX_APPEND_COMPILE_FLAGS([-Wno-unknown-warning-option -Wno-incompatible-pointer-types-discards-qualifiers -Wno-cast-align])
+# For gcc + clang:
+AX_APPEND_COMPILE_FLAGS([-Wno-discarded-qualifiers -Wno-redundant-decls -Wno-switch-enum -Wno-undef])
 
-CFLAGS="$CFLAGS $WARN_CFLAGS $CODE_COVERAGE_CFLAGS"
-LDFLAGS="$LDFLAGS $CODE_COVERAGE_CFLAGS"
+AX_CODE_COVERAGE()
 
 AC_CONFIG_FILES(
   Makefile
@@ -255,7 +198,6 @@ AC_CONFIG_FILES(
   gi/Makefile
   gi/repository/Makefile
   gi/overrides/Makefile
-  gi/_gobject/Makefile
   examples/Makefile
   tests/Makefile
   pygtkcompat/Makefile
@@ -265,9 +207,9 @@ AC_OUTPUT
 AC_MSG_RESULT([
        pygobject $VERSION
 
+       Is release:                     $ax_is_release
        Using python interpreter:       $PYTHON
        cairo support:                  $enable_cairo
-       thread support:                 $enable_thread
        code coverage support:          $enable_code_coverage
 ])
 
index 3a897b1..fb648c3 100644 (file)
@@ -89,10 +89,22 @@ build_triplet = @build@
 host_triplet = @host@
 subdir = examples
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
-       $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
-       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+       $(top_srcdir)/m4/ax_append_flag.m4 \
+       $(top_srcdir)/m4/ax_append_link_flags.m4 \
+       $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+       $(top_srcdir)/m4/ax_check_link_flag.m4 \
+       $(top_srcdir)/m4/ax_code_coverage.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+       $(top_srcdir)/m4/ax_is_release.m4 \
+       $(top_srcdir)/m4/ax_require_defined.m4 \
+       $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
        $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
@@ -124,7 +136,6 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 am__DIST_COMMON = $(srcdir)/Makefile.in
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -147,7 +158,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DLLTOOL = @DLLTOOL@
@@ -180,8 +190,14 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
 INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
 INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
 LCOV = @LCOV@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
@@ -214,14 +230,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
 PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
 PYCAIRO_LIBS = @PYCAIRO_LIBS@
 PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
 PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
 PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
 PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
 PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
 PYTHON_INCLUDES = @PYTHON_INCLUDES@
 PYTHON_LIBS = @PYTHON_LIBS@
@@ -229,15 +243,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
 PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
 VERSION = @VERSION@
 WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
index 319f2ce..3841075 100644 (file)
@@ -2,8 +2,7 @@ PLATFORM_VERSION = 3.0
 
 SUBDIRS = \
        repository \
-       overrides \
-       _gobject
+       overrides
 
 extension_cppflags = \
        $(PYTHON_INCLUDES) \
@@ -55,7 +54,6 @@ _gi_la_SOURCES = \
        pygpointer.h \
        pygtype.c \
        pygtype.h \
-       glibmodule.c \
        pygoptioncontext.c \
        pygoptioncontext.h \
        pygoptiongroup.c \
@@ -121,17 +119,22 @@ _gi_la_SOURCES = \
        pygi-hashtable.c \
        pygi-hashtable.h
 _gi_la_CFLAGS = \
+       $(CODE_COVERAGE_CFLAGS) \
+       $(WARN_CFLAGS) \
        $(extension_cppflags) \
        $(GLIB_CFLAGS) \
        $(GI_CFLAGS)
 _gi_la_CPPFLAGS = \
+       $(CODE_COVERAGE_CPPFLAGS) \
        $(extension_cppflags)
 _gi_la_LIBADD = \
+       $(CODE_COVERAGE_LIBS) \
        $(extension_libadd) \
        $(GLIB_LIBS) \
        $(GI_LIBS) \
        $(FFI_LIBS)
 _gi_la_LDFLAGS = \
+       $(WARN_LDFLAGS) \
        $(extension_ldflags) \
        -export-symbols-regex "init_gi|PyInit__gi"
 
@@ -142,17 +145,22 @@ endif
 _gi_cairo_la_SOURCES = \
        pygi-foreign-cairo.c
 _gi_cairo_la_CFLAGS = \
+       $(CODE_COVERAGE_CFLAGS) \
+       $(WARN_CFLAGS) \
        $(GI_CFLAGS) \
        $(CAIRO_CFLAGS) \
        $(PYCAIRO_CFLAGS)
 _gi_cairo_la_CPPFLAGS = \
+       $(CODE_COVERAGE_CPPFLAGS) \
        $(extension_cppflags)
 _gi_cairo_la_LIBADD = \
+       $(CODE_COVERAGE_LIBS) \
        $(extension_libadd) \
        $(GI_LIBS) \
        $(CAIRO_LIBS) \
        $(PYCAIRO_LIBS)
 _gi_cairo_la_LDFLAGS = \
+       $(WARN_LDFLAGS) \
        $(extension_ldflags) \
        -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo"
 
index 328eaaa..6382c76 100644 (file)
@@ -94,10 +94,22 @@ host_triplet = @host@
 @ENABLE_CAIRO_TRUE@am__append_2 = _gi_cairo.la
 subdir = gi
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
-       $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
-       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+       $(top_srcdir)/m4/ax_append_flag.m4 \
+       $(top_srcdir)/m4/ax_append_link_flags.m4 \
+       $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+       $(top_srcdir)/m4/ax_check_link_flag.m4 \
+       $(top_srcdir)/m4/ax_code_coverage.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+       $(top_srcdir)/m4/ax_is_release.m4 \
+       $(top_srcdir)/m4/ax_require_defined.m4 \
+       $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
        $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
@@ -138,12 +150,13 @@ am__installdirs = "$(DESTDIR)$(pygidir)" "$(DESTDIR)$(pkgincludedir)"
 LTLIBRARIES = $(pygi_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 @OS_WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
-_gi_la_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
-       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+_gi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1)
 am__gi_la_OBJECTS = _gi_la-gobjectmodule.lo _gi_la-pygboxed.lo \
        _gi_la-pygenum.lo _gi_la-pygflags.lo _gi_la-pyginterface.lo \
        _gi_la-pygobject-object.lo _gi_la-pygparamspec.lo \
-       _gi_la-pygpointer.lo _gi_la-pygtype.lo _gi_la-glibmodule.lo \
+       _gi_la-pygpointer.lo _gi_la-pygtype.lo \
        _gi_la-pygoptioncontext.lo _gi_la-pygoptiongroup.lo \
        _gi_la-pygspawn.lo _gi_la-pyglib.lo _gi_la-gimodule.lo \
        _gi_la-pygi-repository.lo _gi_la-pygi-info.lo \
@@ -167,9 +180,9 @@ am__v_lt_1 =
 _gi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gi_la_CFLAGS) $(CFLAGS) \
        $(_gi_la_LDFLAGS) $(LDFLAGS) -o $@
-_gi_cairo_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \
-       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-       $(am__DEPENDENCIES_1)
+_gi_cairo_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am__gi_cairo_la_OBJECTS = _gi_cairo_la-pygi-foreign-cairo.lo
 _gi_cairo_la_OBJECTS = $(am__gi_cairo_la_OBJECTS)
 _gi_cairo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -284,7 +297,6 @@ am__relativize = \
   reldir="$$dir2"
 pkgincludedir = $(includedir)/pygobject-$(PLATFORM_VERSION)
 ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -307,7 +319,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DLLTOOL = @DLLTOOL@
@@ -340,8 +351,14 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
 INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
 INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
 LCOV = @LCOV@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
@@ -374,14 +391,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
 PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
 PYCAIRO_LIBS = @PYCAIRO_LIBS@
 PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
 PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
 PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
 PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
 PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
 PYTHON_INCLUDES = @PYTHON_INCLUDES@
 PYTHON_LIBS = @PYTHON_LIBS@
@@ -389,15 +404,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
 PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
 VERSION = @VERSION@
 WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -458,8 +475,7 @@ top_srcdir = @top_srcdir@
 PLATFORM_VERSION = 3.0
 SUBDIRS = \
        repository \
-       overrides \
-       _gobject
+       overrides
 
 extension_cppflags = \
        $(PYTHON_INCLUDES) \
@@ -498,7 +514,6 @@ _gi_la_SOURCES = \
        pygpointer.h \
        pygtype.c \
        pygtype.h \
-       glibmodule.c \
        pygoptioncontext.c \
        pygoptioncontext.h \
        pygoptiongroup.c \
@@ -565,20 +580,25 @@ _gi_la_SOURCES = \
        pygi-hashtable.h
 
 _gi_la_CFLAGS = \
+       $(CODE_COVERAGE_CFLAGS) \
+       $(WARN_CFLAGS) \
        $(extension_cppflags) \
        $(GLIB_CFLAGS) \
        $(GI_CFLAGS)
 
 _gi_la_CPPFLAGS = \
+       $(CODE_COVERAGE_CPPFLAGS) \
        $(extension_cppflags)
 
 _gi_la_LIBADD = \
+       $(CODE_COVERAGE_LIBS) \
        $(extension_libadd) \
        $(GLIB_LIBS) \
        $(GI_LIBS) \
        $(FFI_LIBS)
 
 _gi_la_LDFLAGS = \
+       $(WARN_LDFLAGS) \
        $(extension_ldflags) \
        -export-symbols-regex "init_gi|PyInit__gi"
 
@@ -586,20 +606,25 @@ _gi_cairo_la_SOURCES = \
        pygi-foreign-cairo.c
 
 _gi_cairo_la_CFLAGS = \
+       $(CODE_COVERAGE_CFLAGS) \
+       $(WARN_CFLAGS) \
        $(GI_CFLAGS) \
        $(CAIRO_CFLAGS) \
        $(PYCAIRO_CFLAGS)
 
 _gi_cairo_la_CPPFLAGS = \
+       $(CODE_COVERAGE_CPPFLAGS) \
        $(extension_cppflags)
 
 _gi_cairo_la_LIBADD = \
+       $(CODE_COVERAGE_LIBS) \
        $(extension_libadd) \
        $(GI_LIBS) \
        $(CAIRO_LIBS) \
        $(PYCAIRO_LIBS)
 
 _gi_cairo_la_LDFLAGS = \
+       $(WARN_LDFLAGS) \
        $(extension_ldflags) \
        -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo"
 
@@ -686,7 +711,6 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_cairo_la-pygi-foreign-cairo.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-gimodule.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-glibmodule.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-gobjectmodule.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygboxed.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygenum.Plo@am__quote@
@@ -811,13 +835,6 @@ _gi_la-pygtype.lo: pygtype.c
 @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) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygtype.lo `test -f 'pygtype.c' || echo '$(srcdir)/'`pygtype.c
 
-_gi_la-glibmodule.lo: glibmodule.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-glibmodule.lo -MD -MP -MF $(DEPDIR)/_gi_la-glibmodule.Tpo -c -o _gi_la-glibmodule.lo `test -f 'glibmodule.c' || echo '$(srcdir)/'`glibmodule.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-glibmodule.Tpo $(DEPDIR)/_gi_la-glibmodule.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='glibmodule.c' object='_gi_la-glibmodule.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) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-glibmodule.lo `test -f 'glibmodule.c' || echo '$(srcdir)/'`glibmodule.c
-
 _gi_la-pygoptioncontext.lo: pygoptioncontext.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygoptioncontext.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygoptioncontext.Tpo -c -o _gi_la-pygoptioncontext.lo `test -f 'pygoptioncontext.c' || echo '$(srcdir)/'`pygoptioncontext.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygoptioncontext.Tpo $(DEPDIR)/_gi_la-pygoptioncontext.Plo
index 1b139c6..9fefc79 100644 (file)
@@ -40,7 +40,6 @@ if 'gobject' in sys.modules:
 
 
 from . import _gi
-from ._gi import _gobject
 from ._gi import _API
 from ._gi import Repository
 from ._gi import PyGIDeprecationWarning
@@ -53,7 +52,13 @@ PyGIWarning = PyGIWarning
 _versions = {}
 _overridesdir = os.path.join(os.path.dirname(__file__), 'overrides')
 
-version_info = _gobject.pygobject_version[:]
+# Needed for compatibility with "pygobject.h"/pygobject_init()
+_gobject = types.ModuleType("gi._gobject")
+sys.modules[_gobject.__name__] = _gobject
+_gobject._PyGObject_API = _gi._PyGObject_API
+_gobject.pygobject_version = _gi.pygobject_version
+
+version_info = _gi.pygobject_version[:]
 __version__ = "{0}.{1}.{2}".format(*version_info)
 
 
index cec8d17..2153f90 100644 (file)
 # You should have received a copy of the GNU Lesser General Public
 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
 
-from ._gi import _gobject
+from . import _gi
 
-TYPE_INVALID = _gobject.TYPE_INVALID
-TYPE_NONE = _gobject.type_from_name('void')
-TYPE_INTERFACE = _gobject.type_from_name('GInterface')
-TYPE_CHAR = _gobject.type_from_name('gchar')
-TYPE_UCHAR = _gobject.type_from_name('guchar')
-TYPE_BOOLEAN = _gobject.type_from_name('gboolean')
-TYPE_INT = _gobject.type_from_name('gint')
-TYPE_UINT = _gobject.type_from_name('guint')
-TYPE_LONG = _gobject.type_from_name('glong')
-TYPE_ULONG = _gobject.type_from_name('gulong')
-TYPE_INT64 = _gobject.type_from_name('gint64')
-TYPE_UINT64 = _gobject.type_from_name('guint64')
-TYPE_ENUM = _gobject.type_from_name('GEnum')
-TYPE_FLAGS = _gobject.type_from_name('GFlags')
-TYPE_FLOAT = _gobject.type_from_name('gfloat')
-TYPE_DOUBLE = _gobject.type_from_name('gdouble')
-TYPE_STRING = _gobject.type_from_name('gchararray')
-TYPE_POINTER = _gobject.type_from_name('gpointer')
-TYPE_BOXED = _gobject.type_from_name('GBoxed')
-TYPE_PARAM = _gobject.type_from_name('GParam')
-TYPE_OBJECT = _gobject.type_from_name('GObject')
-TYPE_PYOBJECT = _gobject.type_from_name('PyObject')
-TYPE_GTYPE = _gobject.type_from_name('GType')
-TYPE_STRV = _gobject.type_from_name('GStrv')
-TYPE_VARIANT = _gobject.type_from_name('GVariant')
+TYPE_INVALID = _gi.TYPE_INVALID
+TYPE_NONE = _gi.type_from_name('void')
+TYPE_INTERFACE = _gi.type_from_name('GInterface')
+TYPE_CHAR = _gi.type_from_name('gchar')
+TYPE_UCHAR = _gi.type_from_name('guchar')
+TYPE_BOOLEAN = _gi.type_from_name('gboolean')
+TYPE_INT = _gi.type_from_name('gint')
+TYPE_UINT = _gi.type_from_name('guint')
+TYPE_LONG = _gi.type_from_name('glong')
+TYPE_ULONG = _gi.type_from_name('gulong')
+TYPE_INT64 = _gi.type_from_name('gint64')
+TYPE_UINT64 = _gi.type_from_name('guint64')
+TYPE_ENUM = _gi.type_from_name('GEnum')
+TYPE_FLAGS = _gi.type_from_name('GFlags')
+TYPE_FLOAT = _gi.type_from_name('gfloat')
+TYPE_DOUBLE = _gi.type_from_name('gdouble')
+TYPE_STRING = _gi.type_from_name('gchararray')
+TYPE_POINTER = _gi.type_from_name('gpointer')
+TYPE_BOXED = _gi.type_from_name('GBoxed')
+TYPE_PARAM = _gi.type_from_name('GParam')
+TYPE_OBJECT = _gi.type_from_name('GObject')
+TYPE_PYOBJECT = _gi.type_from_name('PyObject')
+TYPE_GTYPE = _gi.type_from_name('GType')
+TYPE_STRV = _gi.type_from_name('GStrv')
+TYPE_VARIANT = _gi.type_from_name('GVariant')
 TYPE_UNICHAR = TYPE_UINT
diff --git a/gi/_gobject/Makefile.am b/gi/_gobject/Makefile.am
deleted file mode 100644 (file)
index 37068b8..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-AUTOMAKE_OPTIONS = 1.7
-PLATFORM_VERSION = 3.0
-
-pygobjectdir = $(pyexecdir)/gi/_gobject
-
-pygobject_PYTHON = \
-       __init__.py
-
-# if we build in a separate tree, we need to symlink the *.py files from the
-# source tree; Python does not accept the extensions and modules in different
-# paths
-build_pylinks:
-       for f in $(pygobject_PYTHON); do \
-           [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
-       done
-
-
-all: build_pylinks
-check-local: build_pylinks
diff --git a/gi/_gobject/Makefile.in b/gi/_gobject/Makefile.in
deleted file mode 100644 (file)
index 3c41e5c..0000000
+++ /dev/null
@@ -1,595 +0,0 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-VPATH = @srcdir@
-am__is_gnu_make = { \
-  if test -z '$(MAKELEVEL)'; then \
-    false; \
-  elif test -n '$(MAKE_HOST)'; then \
-    true; \
-  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
-    true; \
-  else \
-    false; \
-  fi; \
-}
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \  ]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = gi/_gobject
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
-       $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
-       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-       $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-DIST_COMMON = $(srcdir)/Makefile.am $(pygobject_PYTHON) \
-       $(am__DIST_COMMON)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-SOURCES =
-DIST_SOURCES =
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
-am__installdirs = "$(DESTDIR)$(pygobjectdir)"
-am__pep3147_tweak = \
-  sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|'
-py_compile = $(top_srcdir)/py-compile
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/py-compile
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CAIRO_CFLAGS = @CAIRO_CFLAGS@
-CAIRO_LIBS = @CAIRO_LIBS@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@
-CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@
-CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@
-CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
-CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
-CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FFI_CFLAGS = @FFI_CFLAGS@
-FFI_LIBS = @FFI_LIBS@
-FGREP = @FGREP@
-GCOV = @GCOV@
-GENHTML = @GENHTML@
-GIO_CFLAGS = @GIO_CFLAGS@
-GIO_LIBS = @GIO_LIBS@
-GI_CFLAGS = @GI_CFLAGS@
-GI_DATADIR = @GI_DATADIR@
-GI_LIBS = @GI_LIBS@
-GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
-GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
-GLIB_LIBS = @GLIB_LIBS@
-GLIB_MKENUMS = @GLIB_MKENUMS@
-GOBJECT_QUERY = @GOBJECT_QUERY@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
-INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
-LCOV = @LCOV@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBFFI_PC = @LIBFFI_PC@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OS_EXT = @OS_EXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
-PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
-PYCAIRO_LIBS = @PYCAIRO_LIBS@
-PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
-PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
-PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
-PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
-PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
-PYTHON_INCLUDES = @PYTHON_INCLUDES@
-PYTHON_LIBS = @PYTHON_LIBS@
-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@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
-VERSION = @VERSION@
-WARN_CFLAGS = @WARN_CFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pkgpyexecdir = @pkgpyexecdir@
-pkgpythondir = @pkgpythondir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pyexecdir = @pyexecdir@
-pythondir = @pythondir@
-runstatedir = @runstatedir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-AUTOMAKE_OPTIONS = 1.7
-PLATFORM_VERSION = 3.0
-pygobjectdir = $(pyexecdir)/gi/_gobject
-pygobject_PYTHON = \
-       __init__.py
-
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gi/_gobject/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --foreign gi/_gobject/Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-install-pygobjectPYTHON: $(pygobject_PYTHON)
-       @$(NORMAL_INSTALL)
-       @list='$(pygobject_PYTHON)'; dlist=; list2=; test -n "$(pygobjectdir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(pygobjectdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(pygobjectdir)" || exit 1; \
-       fi; \
-       for p in $$list; do \
-         if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
-         if test -f $$b$$p; then \
-           $(am__strip_dir) \
-           dlist="$$dlist $$f"; \
-           list2="$$list2 $$b$$p"; \
-         else :; fi; \
-       done; \
-       for file in $$list2; do echo $$file; done | $(am__base_list) | \
-       while read files; do \
-         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pygobjectdir)'"; \
-         $(INSTALL_DATA) $$files "$(DESTDIR)$(pygobjectdir)" || exit $$?; \
-       done || exit $$?; \
-       if test -n "$$dlist"; then \
-         $(am__py_compile) --destdir "$(DESTDIR)" \
-                           --basedir "$(pygobjectdir)" $$dlist; \
-       else :; fi
-
-uninstall-pygobjectPYTHON:
-       @$(NORMAL_UNINSTALL)
-       @list='$(pygobject_PYTHON)'; test -n "$(pygobjectdir)" || list=; \
-       py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       test -n "$$py_files" || exit 0; \
-       dir='$(DESTDIR)$(pygobjectdir)'; \
-       pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \
-       pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \
-       py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \
-       echo "$$py_files_pep3147";\
-       pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \
-       pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \
-       st=0; \
-       for files in \
-         "$$py_files" \
-         "$$pyc_files" \
-         "$$pyo_files" \
-         "$$pyc_files_pep3147" \
-         "$$pyo_files_pep3147" \
-       ; do \
-         $(am__uninstall_files_from_dir) || st=$$?; \
-       done; \
-       exit $$st
-tags TAGS:
-
-ctags CTAGS:
-
-cscope cscopelist:
-
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-       $(MAKE) $(AM_MAKEFLAGS) check-local
-check: check-am
-all-am: Makefile
-installdirs:
-       for dir in "$(DESTDIR)$(pygobjectdir)"; do \
-         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-       done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       if test -z '$(STRIP)'; then \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-             install; \
-       else \
-         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-       fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-       -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-pygobjectPYTHON
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-pygobjectPYTHON
-
-.MAKE: check-am install-am install-strip
-
-.PHONY: all all-am check check-am check-local clean clean-generic \
-       clean-libtool cscopelist-am ctags-am distclean \
-       distclean-generic distclean-libtool 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-pygobjectPYTHON install-strip \
-       installcheck installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-generic \
-       mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
-       uninstall-am uninstall-pygobjectPYTHON
-
-.PRECIOUS: Makefile
-
-
-# if we build in a separate tree, we need to symlink the *.py files from the
-# source tree; Python does not accept the extensions and modules in different
-# paths
-build_pylinks:
-       for f in $(pygobject_PYTHON); do \
-           [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
-       done
-
-all: build_pylinks
-check-local: build_pylinks
-
-# 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.
-.NOEXPORT:
diff --git a/gi/_gobject/__init__.py b/gi/_gobject/__init__.py
deleted file mode 100644 (file)
index 523a102..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- Mode: Python; py-indent-offset: 4 -*-
-# pygobject - Python bindings for the GObject library
-# Copyright (C) 2006-2012  Johan Dahlin
-#
-#   gobject/__init__.py: initialisation file for gobject module
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, see <http://www.gnu.org/licenses/>.
-
-# Needed for compatibility with "pygobject.h"
-import gi._gi
-_PyGObject_API = gi._gi._gobject._PyGObject_API
-pygobject_version = gi._gi._gobject.pygobject_version
index eb711e1..45c74a3 100644 (file)
@@ -40,7 +40,7 @@ else:
     _basestring = basestring
     _bytes = str
 
-from gi._gi import _glib
+from gi import _gi
 from gi._error import GError
 GLib = get_introspection_module('GLib')
 
@@ -209,8 +209,8 @@ class OptionGroup(optparse.OptionGroup):
                 gerror.message = str(error)
                 raise gerror
 
-        group = _glib.OptionGroup(self.name, self.description,
-                                  self.help_description, callback)
+        group = _gi.OptionGroup(self.name, self.description,
+                                self.help_description, callback)
         if self.translation_domain:
             group.set_translation_domain(self.translation_domain)
 
@@ -285,12 +285,12 @@ class OptionParser(optparse.OptionParser):
             parameter_string = self.usage + " - " + self.description
         else:
             parameter_string = self.usage
-        context = _glib.OptionContext(parameter_string)
+        context = _gi.OptionContext(parameter_string)
         context.set_help_enabled(self.help_enabled)
         context.set_ignore_unknown_options(self.ignore_unknown_options)
 
         for option_group in self.option_groups:
-            if isinstance(option_group, _glib.OptionGroup):
+            if isinstance(option_group, _gi.OptionGroup):
                 g_group = option_group
             else:
                 g_group = option_group.get_option_group(self)
@@ -303,7 +303,7 @@ class OptionParser(optparse.OptionParser):
                 opt = self._short_opt[option_name]
             opt.process(option_name, option_value, values, self)
 
-        main_group = _glib.OptionGroup(None, None, None, callback)
+        main_group = _gi.OptionGroup(None, None, None, callback)
         main_entries = []
         for option in self.option_list:
             main_entries.extend(option._to_goptionentries())
@@ -323,7 +323,7 @@ class OptionParser(optparse.OptionParser):
                     args[0].parser = self
                 if args[0].parser is not self:
                     raise ValueError("invalid OptionGroup (wrong parser)")
-            if isinstance(args[0], _glib.OptionGroup):
+            if isinstance(args[0], _gi.OptionGroup):
                 self.option_groups.append(args[0])
                 return
         optparse.OptionParser.add_option_group(self, *args, **kwargs)
index 810bdbc..e81de2e 100644 (file)
@@ -20,8 +20,7 @@
 import sys
 import traceback
 
-import gi._gi
-_gobject = gi._gi._gobject
+from . import _gi
 
 from ._constants import \
     TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR, \
@@ -31,14 +30,14 @@ from ._constants import \
     TYPE_POINTER, TYPE_BOXED, TYPE_PARAM, TYPE_OBJECT, \
     TYPE_PYOBJECT, TYPE_GTYPE, TYPE_STRV, TYPE_VARIANT
 
-G_MAXFLOAT = _gobject.G_MAXFLOAT
-G_MAXDOUBLE = _gobject.G_MAXDOUBLE
-G_MININT = _gobject.G_MININT
-G_MAXINT = _gobject.G_MAXINT
-G_MAXUINT = _gobject.G_MAXUINT
-G_MINLONG = _gobject.G_MINLONG
-G_MAXLONG = _gobject.G_MAXLONG
-G_MAXULONG = _gobject.G_MAXULONG
+G_MAXFLOAT = _gi.G_MAXFLOAT
+G_MAXDOUBLE = _gi.G_MAXDOUBLE
+G_MININT = _gi.G_MININT
+G_MAXINT = _gi.G_MAXINT
+G_MAXUINT = _gi.G_MAXUINT
+G_MINLONG = _gi.G_MINLONG
+G_MAXLONG = _gi.G_MAXLONG
+G_MAXULONG = _gi.G_MAXULONG
 
 if sys.version_info >= (3, 0):
     _basestring = str
@@ -153,7 +152,7 @@ class Property(object):
             return "<class 'GObject.Property'>"
 
     def __init__(self, getter=None, setter=None, type=None, default=None,
-                 nick='', blurb='', flags=_gobject.PARAM_READWRITE,
+                 nick='', blurb='', flags=_gi.PARAM_READWRITE,
                  minimum=None, maximum=None):
         self.name = None
 
@@ -211,7 +210,7 @@ class Property(object):
     def __repr__(self):
         return '<GObject Property %s (%s)>' % (
             self.name or '(uninitialized)',
-            _gobject.type_name(self.type))
+            _gi.type_name(self.type))
 
     def __get__(self, instance, klass):
         if instance is None:
@@ -276,11 +275,11 @@ class Property(object):
         if type_ in self._type_from_pytype_lookup:
             return self._type_from_pytype_lookup[type_]
         elif (isinstance(type_, type) and
-              issubclass(type_, (_gobject.GObject,
-                                 _gobject.GEnum,
-                                 _gobject.GFlags,
-                                 _gobject.GBoxed,
-                                 _gobject.GInterface))):
+              issubclass(type_, (_gi.GObject,
+                                 _gi.GEnum,
+                                 _gi.GFlags,
+                                 _gi.GBoxed,
+                                 _gi.GInterface))):
             return type_.__gtype__
         elif type_ in (TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR,
                        TYPE_INT, TYPE_UINT, TYPE_BOOLEAN, TYPE_LONG,
@@ -309,24 +308,24 @@ class Property(object):
         elif ptype == TYPE_GTYPE:
             if default is not None:
                 raise TypeError("GType types does not have default values")
-        elif _gobject.type_is_a(ptype, TYPE_ENUM):
+        elif _gi.type_is_a(ptype, TYPE_ENUM):
             if default is None:
                 raise TypeError("enum properties needs a default value")
-            elif not _gobject.type_is_a(default, ptype):
+            elif not _gi.type_is_a(default, ptype):
                 raise TypeError("enum value %s must be an instance of %r" %
                                 (default, ptype))
-        elif _gobject.type_is_a(ptype, TYPE_FLAGS):
-            if not _gobject.type_is_a(default, ptype):
+        elif _gi.type_is_a(ptype, TYPE_FLAGS):
+            if not _gi.type_is_a(default, ptype):
                 raise TypeError("flags value %s must be an instance of %r" %
                                 (default, ptype))
-        elif _gobject.type_is_a(ptype, TYPE_STRV) and default is not None:
+        elif _gi.type_is_a(ptype, TYPE_STRV) and default is not None:
             if not isinstance(default, list):
                 raise TypeError("Strv value %s must be a list" % repr(default))
             for val in default:
                 if type(val) not in (str, bytes):
                     raise TypeError("Strv value %s must contain only strings" % str(default))
-        elif _gobject.type_is_a(ptype, TYPE_VARIANT) and default is not None:
-            if not hasattr(default, '__gtype__') or not _gobject.type_is_a(default, TYPE_VARIANT):
+        elif _gi.type_is_a(ptype, TYPE_VARIANT) and default is not None:
+            if not hasattr(default, '__gtype__') or not _gi.type_is_a(default, TYPE_VARIANT):
                 raise TypeError("variant value %s must be an instance of %r" %
                                 (default, ptype))
 
index 30ff541..29d36ea 100644 (file)
@@ -19,7 +19,7 @@
 
 import sys
 
-from ._gi import _gobject
+from . import _gi
 
 # Callable went away in python 3.0 and came back in 3.2.
 # Use versioning to figure out when to define it, otherwise we have to deal with
@@ -127,7 +127,7 @@ class Signal(str):
             name = name.__name__
         return str.__new__(cls, name)
 
-    def __init__(self, name='', func=None, flags=_gobject.SIGNAL_RUN_FIRST,
+    def __init__(self, name='', func=None, flags=_gi.SIGNAL_RUN_FIRST,
                  return_type=None, arg_types=None, doc='', accumulator=None, accu_data=None):
         if func and not name:
             name = func.__name__
@@ -164,7 +164,7 @@ class Signal(str):
 
         # If obj is a GObject, than we call this signal as a closure otherwise
         # it is used as a re-application of a decorator.
-        if isinstance(obj, _gobject.GObject):
+        if isinstance(obj, _gi.GObject):
             self.func(obj, *args, **kargs)
         else:
             # If self is already an allocated name, use it otherwise create a new named
index d60a6a5..e14b4f6 100644 (file)
  * USA
  */
 
+#include <Python.h>
 #include <glib-object.h>
 
+#include "config.h"
 #include "pyglib.h"
 #include "pyginterface.h"
 #include "pygi-repository.h"
 #include "pygi-boxed.h"
 #include "pygi-info.h"
 #include "pygi-struct.h"
+#include "pygobject-object.h"
+#include "pygoptioncontext.h"
+#include "pygoptiongroup.h"
+#include "pygspawn.h"
+#include "gobjectmodule.h"
+#include "pygparamspec.h"
+#include "pygpointer.h"
 
 #include <pyglib-python-compat.h>
 
@@ -567,7 +576,7 @@ pyg_channel_read(PyObject* self, PyObject *args, PyObject *kwargs)
     iochannel = pyg_boxed_get (py_iochannel, GIOChannel);
 
     while (status == G_IO_STATUS_NORMAL
-          && (max_count == -1 || total_read < max_count)) {
+          && (max_count == -1 || total_read < (gsize)max_count)) {
        gsize single_read;
        char* buf;
        gsize buf_size;
@@ -585,7 +594,7 @@ pyg_channel_read(PyObject* self, PyObject *args, PyObject *kwargs)
            if (ret_obj == NULL)
                goto failure;
        }
-       else if (buf_size + total_read > PYGLIB_PyBytes_Size(ret_obj)) {
+       else if (buf_size + total_read > (gsize)PYGLIB_PyBytes_Size(ret_obj)) {
            if (PYGLIB_PyBytes_Resize(&ret_obj, buf_size + total_read) == -1)
                goto failure;
        }
@@ -602,7 +611,7 @@ pyg_channel_read(PyObject* self, PyObject *args, PyObject *kwargs)
        total_read += single_read;
     }
        
-    if ( total_read != PYGLIB_PyBytes_Size(ret_obj) ) {
+    if ( total_read != (gsize)PYGLIB_PyBytes_Size(ret_obj) ) {
        if (PYGLIB_PyBytes_Resize(&ret_obj, total_read) == -1)
            goto failure;
     }
@@ -627,6 +636,34 @@ static PyMethodDef _gi_functions[] = {
     { "source_set_callback", (PyCFunction) pyg_source_set_callback, METH_VARARGS },
     { "io_channel_read", (PyCFunction) pyg_channel_read, METH_VARARGS },
     { "require_foreign", (PyCFunction) pygi_require_foreign, METH_VARARGS | METH_KEYWORDS },
+    { "spawn_async",
+      (PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS,
+      "spawn_async(argv, envp=None, working_directory=None,\n"
+      "            flags=0, child_setup=None, user_data=None,\n"
+      "            standard_input=None, standard_output=None,\n"
+      "            standard_error=None) -> (pid, stdin, stdout, stderr)\n"
+      "\n"
+      "Execute a child program asynchronously within a glib.MainLoop()\n"
+      "See the reference manual for a complete reference.\n" },
+    { "type_name", pyg_type_name, METH_VARARGS },
+    { "type_from_name", pyg_type_from_name, METH_VARARGS },
+    { "type_is_a", pyg_type_is_a, METH_VARARGS },
+    { "type_register", _wrap_pyg_type_register, METH_VARARGS },
+    { "signal_new", pyg_signal_new, METH_VARARGS },
+    { "list_properties",
+      pyg_object_class_list_properties, METH_VARARGS },
+    { "new",
+      (PyCFunction)pyg_object_new, METH_VARARGS|METH_KEYWORDS },
+    { "signal_accumulator_true_handled",
+      (PyCFunction)pyg_signal_accumulator_true_handled, METH_VARARGS },
+    { "add_emission_hook",
+      (PyCFunction)pyg_add_emission_hook, METH_VARARGS },
+    { "_install_metaclass",
+      (PyCFunction)pyg__install_metaclass, METH_O },
+    { "_gvalue_get",
+      (PyCFunction)pyg__gvalue_get, METH_O },
+    { "_gvalue_set",
+      (PyCFunction)pyg__gvalue_set, METH_VARARGS },
     { NULL, NULL, 0 }
 };
 
@@ -637,8 +674,7 @@ static struct PyGI_API CAPI = {
 PYGLIB_MODULE_START(_gi, "_gi")
 {
     PyObject *api;
-    PyObject *_glib_module;
-    PyObject *_gobject_module;
+    PyObject *module_dict = PyModule_GetDict (module);
 
     /* Always enable Python threads since we cannot predict which GI repositories
      * might accept Python callbacks run within non-Python threads or might trigger
@@ -647,29 +683,6 @@ PYGLIB_MODULE_START(_gi, "_gi")
      */
     PyEval_InitThreads ();
 
-    _glib_module = pyglib__glib_module_create ();
-    if (_glib_module == NULL) {
-        return PYGLIB_MODULE_ERROR_RETURN;
-    }
-    /* In Python 2.x, pyglib_..._module_create returns a borrowed reference and
-     * PyModule_AddObject steals a reference. Ensure we don't share a reference
-     * between sys.modules and gi._gi._glib by incrementing the ref count here.
-     * Note that we don't add this to the PYGLIB_MODULE_START macro because that
-     * would cause a leak for the main module gi._gi */
-    if (PY_MAJOR_VERSION < 3) {
-        Py_INCREF (_glib_module);
-    }
-    PyModule_AddObject (module, "_glib", _glib_module);
-    PyModule_AddStringConstant(module, "__package__", "gi._gi");
-
-    _gobject_module = pyglib__gobject_module_create ();
-    if (_gobject_module == NULL) {
-        return PYGLIB_MODULE_ERROR_RETURN;
-    }
-    if (PY_MAJOR_VERSION < 3) {
-        Py_INCREF (_gobject_module);
-    }
-    PyModule_AddObject (module, "_gobject", _gobject_module);
     PyModule_AddStringConstant(module, "__package__", "gi._gi");
 
     pygi_foreign_init ();
@@ -681,6 +694,24 @@ PYGLIB_MODULE_START(_gi, "_gi")
     _pygi_ccallback_register_types (module);
     pygi_resulttuple_register_types (module);
 
+    pyglib_spawn_register_types (module_dict);
+    pyglib_option_context_register_types (module_dict);
+    pyglib_option_group_register_types (module_dict);
+
+    pygobject_register_api (module_dict);
+    pygobject_register_constants (module);
+    pygobject_register_features (module_dict);
+    pygobject_register_version_tuples (module_dict);
+    pygobject_register_warnings (module_dict);
+    pygobject_type_register_types (module_dict);
+    pygobject_object_register_types (module_dict);
+    pygobject_interface_register_types (module_dict);
+    pygobject_paramspec_register_types (module_dict);
+    pygobject_boxed_register_types (module_dict);
+    pygobject_pointer_register_types (module_dict);
+    pygobject_enum_register_types (module_dict);
+    pygobject_flags_register_types (module_dict);
+
     PyGIWarning = PyErr_NewException ("gi.PyGIWarning", PyExc_Warning, NULL);
 
     /* Use RuntimeWarning as the base class of PyGIDeprecationWarning
diff --git a/gi/glibmodule.c b/gi/glibmodule.c
deleted file mode 100644 (file)
index 63b84c8..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; c-set-style: python; c-basic-offset: 4  -*-
- * pyglib - Python bindings for GLib toolkit.
- * Copyright (C) 1998-2003  James Henstridge
- *               2004-2008  Johan Dahlin
- *
- *   glibmodule.c: wrapper for the glib library.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <Python.h>
-#include <glib.h>
-#include "pyglib.h"
-#include "pygoptioncontext.h"
-#include "pygoptiongroup.h"
-#include "pygspawn.h"
-
-/* ---------------- glib module functions -------------------- */
-
-static PyMethodDef _glib_functions[] = {
-    { "spawn_async",
-      (PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS,
-      "spawn_async(argv, envp=None, working_directory=None,\n"
-      "            flags=0, child_setup=None, user_data=None,\n"
-      "            standard_input=None, standard_output=None,\n"
-      "            standard_error=None) -> (pid, stdin, stdout, stderr)\n"
-      "\n"
-      "Execute a child program asynchronously within a glib.MainLoop()\n"
-      "See the reference manual for a complete reference.\n" },
-    { NULL, NULL, 0 }
-};
-
-PYGLIB_MODULE_START(_glib, "_glib")
-{
-    PyObject *d = PyModule_GetDict(module);
-
-    pyglib_spawn_register_types(d);
-    pyglib_option_context_register_types(d);
-    pyglib_option_group_register_types(d);
-}
-PYGLIB_MODULE_END
index 0dc2670..ba1b9fc 100644 (file)
@@ -60,11 +60,11 @@ static void
 _pyg_set_thread_block_funcs (PyGThreadBlockFunc block_threads_func,
                             PyGThreadBlockFunc unblock_threads_func)
 {
-    PyGILState_STATE state = pyglib_gil_state_ensure ();
+    PyGILState_STATE state = PyGILState_Ensure ();
     PyErr_Warn (PyExc_DeprecationWarning,
                 "Using pyg_set_thread_block_funcs is not longer needed. "
                 "PyGObject always uses Py_BLOCK/UNBLOCK_THREADS.");
-    pyglib_gil_state_release (state);
+    PyGILState_Release (state);
 }
 
 /**
@@ -80,15 +80,15 @@ pyg_destroy_notify(gpointer user_data)
     PyObject *obj = (PyObject *)user_data;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_DECREF(obj);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 
 /* ---------------- gobject module functions -------------------- */
 
-static PyObject *
+PyObject *
 pyg_type_name (PyObject *self, PyObject *args)
 {
     PyObject *gtype;
@@ -113,7 +113,7 @@ pyg_type_name (PyObject *self, PyObject *args)
     return NULL;
 }
 
-static PyObject *
+PyObject *
 pyg_type_from_name (PyObject *self, PyObject *args)
 {
     const gchar *name;
@@ -138,7 +138,7 @@ pyg_type_from_name (PyObject *self, PyObject *args)
     return NULL;
 }
 
-static PyObject *
+PyObject *
 pyg_type_is_a (PyObject *self, PyObject *args)
 {
     PyObject *gtype, *gparent;
@@ -166,12 +166,12 @@ pyg_object_set_property (GObject *object, guint property_id,
     PyObject *py_pspec, *py_value;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     object_wrapper = pygobject_new(object);
 
     if (object_wrapper == NULL) {
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return;
     }
 
@@ -190,7 +190,7 @@ pyg_object_set_property (GObject *object, guint property_id,
     Py_DECREF(py_pspec);
     Py_DECREF(py_value);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 static void
@@ -200,12 +200,12 @@ pyg_object_get_property (GObject *object, guint property_id,
     PyObject *object_wrapper, *retval;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     object_wrapper = pygobject_new(object);
 
     if (object_wrapper == NULL) {
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return;
     }
 
@@ -216,7 +216,7 @@ pyg_object_get_property (GObject *object, guint property_id,
     Py_DECREF(object_wrapper);
     Py_XDECREF(retval);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 typedef struct _PyGSignalAccumulatorData {
@@ -236,7 +236,7 @@ _pyg_signal_accumulator(GSignalInvocationHint *ihint,
     PyGSignalAccumulatorData *data = _data;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     if (ihint->detail)
         py_detail = PYGLIB_PyUnicode_FromString(g_quark_to_string(ihint->detail));
     else {
@@ -270,7 +270,7 @@ _pyg_signal_accumulator(GSignalInvocationHint *ihint,
         }
         Py_DECREF(py_retval);
     }
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return retval;
 }
 
@@ -783,19 +783,19 @@ add_properties (GObjectClass *klass, PyObject *properties)
        if (pspec) {
            g_object_class_install_property(klass, 1, pspec);
        } else {
-            PyObject *type, *value, *traceback;
+            PyObject *type, *pvalue, *traceback;
            ret = FALSE;
-            PyErr_Fetch(&type, &value, &traceback);
-            if (PYGLIB_PyUnicode_Check(value)) {
+            PyErr_Fetch(&type, &pvalue, &traceback);
+            if (PYGLIB_PyUnicode_Check(pvalue)) {
                 char msg[256];
                 g_snprintf(msg, 256,
                           "%s (while registering property '%s' for GType '%s')",
-               PYGLIB_PyUnicode_AsString(value),
+               PYGLIB_PyUnicode_AsString(pvalue),
                           prop_name, G_OBJECT_CLASS_NAME(klass));
-                Py_DECREF(value);
+                Py_DECREF(pvalue);
                 value = PYGLIB_PyUnicode_FromString(msg);
             }
-            PyErr_Restore(type, value, traceback);
+            PyErr_Restore(type, pvalue, traceback);
            break;
        }
     }
@@ -892,7 +892,7 @@ pyg_run_class_init(GType gtype, gpointer gclass, PyTypeObject *pyclass)
     return 0;
 }
 
-static PyObject *
+PyObject *
 _wrap_pyg_type_register(PyObject *self, PyObject *args)
 {
     PyTypeObject *class;
@@ -986,9 +986,10 @@ pygobject_constructv(PyGObject  *self,
 
     g_assert (self->obj == NULL);
     pygobject_init_wrapper_set((PyObject *) self);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     obj = g_object_newv(pyg_type_from_object((PyObject *) self),
                         n_parameters, parameters);
-
+G_GNUC_END_IGNORE_DEPRECATIONS
     if (g_object_is_floating (obj))
         self->private_flags.flags |= PYGOBJECT_GOBJECT_WAS_FLOATING;
     pygobject_sink (obj);
@@ -1021,7 +1022,7 @@ pygobject__g_instance_init(GTypeInstance   *instance,
            * g_object_new -> we have no python wrapper, so create it
            * now */
         PyGILState_STATE state;
-        state = pyglib_gil_state_ensure();
+        state = PyGILState_Ensure();
         wrapper = pygobject_new_full(object,
                                      /*steal=*/ FALSE,
                                      g_class);
@@ -1037,7 +1038,7 @@ pygobject__g_instance_init(GTypeInstance   *instance,
 
         Py_DECREF(args);
         Py_DECREF(kwargs);
-        pyglib_gil_state_release(state);
+        PyGILState_Release(state);
     }
 }
 
@@ -1214,7 +1215,7 @@ pyg_type_register(PyTypeObject *class, const char *type_name)
     return 0;
 }
 
-static PyObject *
+PyObject *
 pyg_signal_new(PyObject *self, PyObject *args)
 {
     gchar *signal_name;
@@ -1281,7 +1282,7 @@ pyg_signal_new(PyObject *self, PyObject *args)
     return NULL;
 }
 
-static PyObject *
+PyObject *
 pyg_object_class_list_properties (PyObject *self, PyObject *args)
 {
     GParamSpec **specs;
@@ -1338,7 +1339,7 @@ pyg_object_class_list_properties (PyObject *self, PyObject *args)
     return list;
 }
 
-static PyObject *
+PyObject *
 pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs)
 {
     PyObject *pytype;
@@ -1370,7 +1371,10 @@ pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs)
     if (!pygobject_prepare_construct_properties (class, kwargs, &n_params, &params))
         goto cleanup;
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     obj = g_object_newv(type, n_params, params);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
     if (!obj)
        PyErr_SetString (PyExc_RuntimeError, "could not create object");
 
@@ -1395,13 +1399,13 @@ pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs)
 static int
 pygobject_gil_state_ensure (void)
 {
-    return pyglib_gil_state_ensure ();
+    return PyGILState_Ensure ();
 }
 
 static void
 pygobject_gil_state_release (int flag)
 {
-    pyglib_gil_state_release(flag);
+    PyGILState_Release(flag);
 }
 
 /* Only for backwards compatibility */
@@ -1411,7 +1415,7 @@ pygobject_enable_threads(void)
     return 0;
 }
 
-static PyObject *
+PyObject *
 pyg_signal_accumulator_true_handled(PyObject *unused, PyObject *args)
 {
     PyErr_SetString(PyExc_TypeError,
@@ -1433,7 +1437,7 @@ marshal_emission_hook(GSignalInvocationHint *ihint,
     PyObject *params;
     guint i;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* construct Python tuple for the parameter values */
     params = PyTuple_New(n_param_values);
@@ -1464,11 +1468,11 @@ marshal_emission_hook(GSignalInvocationHint *ihint,
     retval = (retobj == Py_True ? TRUE : FALSE);
     Py_XDECREF(retobj);
 out:
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return retval;
 }
 
-static PyObject *
+PyObject *
 pyg_add_emission_hook(PyGObject *self, PyObject *args)
 {
     PyObject *first, *callback, *extra_args, *data, *repr;
@@ -1526,7 +1530,7 @@ pyg_add_emission_hook(PyGObject *self, PyObject *args)
     return PyLong_FromUnsignedLong(hook_id);
 }
 
-static PyObject *
+PyObject *
 pyg__install_metaclass(PyObject *dummy, PyTypeObject *metaclass)
 {
     Py_INCREF(metaclass);
@@ -1539,7 +1543,7 @@ pyg__install_metaclass(PyObject *dummy, PyTypeObject *metaclass)
     return Py_None;
 }
 
-static PyObject *
+PyObject *
 pyg__gvalue_get(PyObject *module, PyObject *pygvalue)
 {
     if (!pyg_boxed_check (pygvalue, G_TYPE_VALUE)) {
@@ -1551,13 +1555,13 @@ pyg__gvalue_get(PyObject *module, PyObject *pygvalue)
                                   /*copy_boxed=*/ TRUE);
 }
 
-static PyObject *
+PyObject *
 pyg__gvalue_set(PyObject *module, PyObject *args)
 {
     PyObject *pygvalue;
     PyObject *pyobject;
 
-    if (!PyArg_ParseTuple (args, "OO:_gobject._gvalue_set",
+    if (!PyArg_ParseTuple (args, "OO:_gi._gvalue_set",
                            &pygvalue, &pyobject))
         return NULL;
 
@@ -1573,30 +1577,6 @@ pyg__gvalue_set(PyObject *module, PyObject *args)
     Py_RETURN_NONE;
 }
 
-static PyMethodDef _gobject_functions[] = {
-    { "type_name", pyg_type_name, METH_VARARGS },
-    { "type_from_name", pyg_type_from_name, METH_VARARGS },
-    { "type_is_a", pyg_type_is_a, METH_VARARGS },
-    { "type_register", _wrap_pyg_type_register, METH_VARARGS },
-    { "signal_new", pyg_signal_new, METH_VARARGS },
-    { "list_properties",
-      pyg_object_class_list_properties, METH_VARARGS },
-    { "new",
-      (PyCFunction)pyg_object_new, METH_VARARGS|METH_KEYWORDS },
-    { "signal_accumulator_true_handled",
-      (PyCFunction)pyg_signal_accumulator_true_handled, METH_VARARGS },
-    { "add_emission_hook",
-      (PyCFunction)pyg_add_emission_hook, METH_VARARGS },
-    { "_install_metaclass",
-      (PyCFunction)pyg__install_metaclass, METH_O },
-    { "_gvalue_get",
-      (PyCFunction)pyg__gvalue_get, METH_O },
-    { "_gvalue_set",
-      (PyCFunction)pyg__gvalue_set, METH_VARARGS },
-
-    { NULL, NULL, 0 }
-};
-
 
 /* ----------------- Constant extraction ------------------------ */
 
@@ -1616,7 +1596,7 @@ static PyMethodDef _gobject_functions[] = {
 const gchar *
 pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix)
 {
-    gint prefix_len;
+    size_t prefix_len;
     guint i;
 
     prefix_len = strlen(strip_prefix);
@@ -1632,9 +1612,9 @@ pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix)
 
     /* strip off prefix from value name, while keeping it a valid
      * identifier */
-    for (i = prefix_len; i >= 0; i--) {
-       if (g_ascii_isalpha(name[i]) || name[i] == '_') {
-           return &name[i];
+    for (i = prefix_len + 1; i > 0; i--) {
+       if (g_ascii_isalpha(name[i - 1]) || name[i - 1] == '_') {
+           return &name[i - 1];
        }
     }
     return name;
@@ -1757,7 +1737,7 @@ pyg_parse_constructor_args(GType        obj_type,
         params[param_i].name = prop_names[arg_i];
         g_value_init(&params[param_i].value, spec->value_type);
         if (pyg_value_from_pyobject(&params[param_i].value, py_args[arg_i]) == -1) {
-            int i;
+            guint i;
             PyErr_Format(PyExc_TypeError, "could not convert parameter '%s' of type '%s'",
                          arg_names[arg_i], g_type_name(spec->value_type));
             g_type_class_unref(oclass);
@@ -1783,9 +1763,9 @@ _log_func(const gchar *log_domain,
        PyGILState_STATE state;
        PyObject* warning = user_data;
 
-       state = pyglib_gil_state_ensure();
+       state = PyGILState_Ensure();
        PyErr_Warn(warning, (char *) message);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
     } else
         g_log_default_handler(log_domain, log_level, message, user_data);
 }
@@ -1893,12 +1873,7 @@ struct _PyGObject_Functions pygobject_api_functions = {
   pyg_flags_add,
   pyg_flags_from_gtype,
 
-  /* threads_enabled */
-#ifdef DISABLE_THREADING
-  FALSE,
-#else
-  TRUE,
-#endif
+  TRUE, /* threads_enabled */
 
   pygobject_enable_threads,
   pygobject_gil_state_ensure,
@@ -1925,7 +1900,7 @@ struct _PyGObject_Functions pygobject_api_functions = {
 };
 
 /* for addon libraries ... */
-static void
+void
 pygobject_register_api(PyObject *d)
 {
     PyObject *api;
@@ -1936,7 +1911,7 @@ pygobject_register_api(PyObject *d)
 }
 
 /* some constants */
-static void
+void
 pygobject_register_constants(PyObject *m)
 {
     /* PyFloat_ return a new ref, and add object takes the ref */
@@ -1968,7 +1943,7 @@ pygobject_register_constants(PyObject *m)
 }
 
 /* features */
-static void
+void
 pygobject_register_features(PyObject *d)
 {
     PyObject *features;
@@ -1979,7 +1954,7 @@ pygobject_register_features(PyObject *d)
     Py_DECREF(features);
 }
 
-static void
+void
 pygobject_register_version_tuples(PyObject *d)
 {
     PyObject *tuple;
@@ -1992,7 +1967,7 @@ pygobject_register_version_tuples(PyObject *d)
     PyDict_SetItemString(d, "pygobject_version", tuple);
 }
 
-static void
+void
 pygobject_register_warnings(PyObject *d)
 {
     PyObject *warning;
@@ -2003,25 +1978,3 @@ pygobject_register_warnings(PyObject *d)
     add_warning_redirection("GLib-GObject", warning);
     add_warning_redirection("GThread", warning);
 }
-
-
-PYGLIB_MODULE_START(_gobject, "_gobject")
-{
-    PyObject *d;
-
-    d = PyModule_GetDict(module);
-    pygobject_register_api(d);
-    pygobject_register_constants(module);
-    pygobject_register_features(d);
-    pygobject_register_version_tuples(d);
-    pygobject_register_warnings(d);
-    pygobject_type_register_types(d);
-    pygobject_object_register_types(d);
-    pygobject_interface_register_types(d);
-    pygobject_paramspec_register_types(d);
-    pygobject_boxed_register_types(d);
-    pygobject_pointer_register_types(d);
-    pygobject_enum_register_types(d);
-    pygobject_flags_register_types(d);
-}
-PYGLIB_MODULE_END
index 11f99cf..50bb6d1 100644 (file)
@@ -8,4 +8,25 @@ int           pygobject_constructv (PyGObject   *self,
                                     guint        n_parameters,
                                     GParameter  *parameters);
 
+void        pygobject_register_api              (PyObject *d);
+void        pygobject_register_constants        (PyObject *m);
+void        pygobject_register_features         (PyObject *d);
+void        pygobject_register_version_tuples   (PyObject *d);
+void        pygobject_register_warnings         (PyObject *d);
+
+PyObject *  pyg_type_name                       (PyObject *self, PyObject *args);
+PyObject *  pyg_type_from_name                  (PyObject *self, PyObject *args);
+PyObject *  pyg_type_is_a                       (PyObject *self, PyObject *args);
+PyObject *  _wrap_pyg_type_register             (PyObject *self, PyObject *args);
+PyObject *  pyg_signal_new                      (PyObject *self, PyObject *args);
+PyObject *  pyg_object_class_list_properties    (PyObject *self, PyObject *args);
+PyObject *  pyg_object_new                      (PyGObject *self, PyObject *args,
+                                                 PyObject *kwargs);
+PyObject *  pyg_signal_accumulator_true_handled (PyObject *unused, PyObject *args);
+PyObject *  pyg_add_emission_hook               (PyGObject *self, PyObject *args);
+PyObject *  pyg__install_metaclass              (PyObject *dummy,
+                                                 PyTypeObject *metaclass);
+PyObject *  pyg__gvalue_get                     (PyObject *module, PyObject *pygvalue);
+PyObject *  pyg__gvalue_set                     (PyObject *module, PyObject *args);
+
 #endif /*_PYGOBJECT_GOBJECTMODULE_H_*/
index fd8f508..0b22634 100644 (file)
@@ -53,13 +53,11 @@ from ._gi import \
     enum_register_new_gtype_and_add, \
     flags_add, \
     flags_register_new_gtype_and_add, \
-    _gobject
+    GInterface
 from .types import \
     GObjectMeta, \
     StructMeta
 
-GInterface = _gobject.GInterface
-
 from ._constants import \
     TYPE_NONE, \
     TYPE_BOXED, \
@@ -82,7 +80,7 @@ def get_parent_for_object(object_info):
         # for an existing wrapper on the GType and use it as a base for the
         # new introspection wrapper. This allows static C wrappers already
         # registered with the GType to be used as the introspection base
-        # (_gobject.GObject for example)
+        # (_gi.GObject for example)
         gtype = object_info.get_g_type()
         if gtype and gtype.pytype:
             return gtype.pytype
index ab0e83a..372d6d4 100644 (file)
@@ -40,15 +40,14 @@ __all__.append('option')
 
 
 # Types and functions still needed from static bindings
-from gi._gi import _glib
-from gi._gi import _gobject
+from gi import _gi
 from gi._error import GError
 
 Error = GError
-OptionContext = _glib.OptionContext
-OptionGroup = _glib.OptionGroup
-Pid = _glib.Pid
-spawn_async = _glib.spawn_async
+OptionContext = _gi.OptionContext
+OptionGroup = _gi.OptionGroup
+Pid = _gi.Pid
+spawn_async = _gi.spawn_async
 
 
 def threads_init():
@@ -552,7 +551,7 @@ for name in ['G_MINFLOAT', 'G_MAXFLOAT', 'G_MINDOUBLE', 'G_MAXDOUBLE',
              'G_MAXUINT', 'G_MINLONG', 'G_MAXLONG', 'G_MAXULONG', 'G_MAXSIZE',
              'G_MINSSIZE', 'G_MAXSSIZE', 'G_MINOFFSET', 'G_MAXOFFSET']:
     attr = name.split("_", 1)[-1]
-    globals()[attr] = getattr(_gobject, name)
+    globals()[attr] = getattr(_gi, name)
     __all__.append(attr)
 
 
index 2e8f755..c252bfa 100644 (file)
@@ -33,8 +33,8 @@ from gi import PyGIDeprecationWarning
 
 from gi import _propertyhelper as propertyhelper
 from gi import _signalhelper as signalhelper
+from gi import _gi
 
-_gobject = gi._gi._gobject
 
 GObjectModule = gi.module.get_introspection_module('GObject')
 
@@ -42,7 +42,7 @@ __all__ = []
 
 
 from gi import _option as option
-sys.modules['gi._gobject.option'] = option
+option = option
 
 
 # API aliases for backwards compatibility
@@ -184,27 +184,27 @@ for name in ['SIGNAL_ACTION', 'SIGNAL_DETAILED', 'SIGNAL_NO_HOOKS',
     __all__.append(name)
 
 # Static types
-GBoxed = _gobject.GBoxed
-GEnum = _gobject.GEnum
-GFlags = _gobject.GFlags
-GInterface = _gobject.GInterface
-GObject = _gobject.GObject
-GObjectWeakRef = _gobject.GObjectWeakRef
-GParamSpec = _gobject.GParamSpec
-GPointer = _gobject.GPointer
-GType = _gobject.GType
-Warning = _gobject.Warning
+GBoxed = _gi.GBoxed
+GEnum = _gi.GEnum
+GFlags = _gi.GFlags
+GInterface = _gi.GInterface
+GObject = _gi.GObject
+GObjectWeakRef = _gi.GObjectWeakRef
+GParamSpec = _gi.GParamSpec
+GPointer = _gi.GPointer
+GType = _gi.GType
+Warning = _gi.Warning
 __all__ += ['GBoxed', 'GEnum', 'GFlags', 'GInterface', 'GObject',
             'GObjectWeakRef', 'GParamSpec', 'GPointer', 'GType',
             'Warning']
 
 
-features = _gobject.features
-list_properties = _gobject.list_properties
-new = _gobject.new
-pygobject_version = _gobject.pygobject_version
+features = _gi.features
+list_properties = _gi.list_properties
+new = _gi.new
+pygobject_version = _gi.pygobject_version
 threads_init = GLib.threads_init
-type_register = _gobject.type_register
+type_register = _gi.type_register
 __all__ += ['features', 'list_properties', 'new',
             'pygobject_version', 'threads_init', 'type_register']
 
@@ -228,15 +228,15 @@ class Value(GObjectModule.Value):
         # Workaround the introspection marshalers inability to know
         # these methods should be marshaling boxed types. This is because
         # the type information is stored on the GValue.
-        _gobject._gvalue_set(self, boxed)
+        _gi._gvalue_set(self, boxed)
 
     def get_boxed(self):
-        return _gobject._gvalue_get(self)
+        return _gi._gvalue_get(self)
 
     def set_value(self, py_value):
         gtype = self.g_type
 
-        if gtype == _gobject.TYPE_INVALID:
+        if gtype == _gi.TYPE_INVALID:
             raise TypeError("GObject.Value needs to be initialized first")
         elif gtype == TYPE_BOOLEAN:
             self.set_boolean(py_value)
@@ -527,8 +527,8 @@ __all__.append('signal_accumulator_true_handled')
 
 # Statically bound signal functions which need to clobber GI (for now)
 
-add_emission_hook = _gobject.add_emission_hook
-signal_new = _gobject.signal_new
+add_emission_hook = _gi.add_emission_hook
+signal_new = _gi.signal_new
 
 __all__ += ['add_emission_hook', 'signal_new']
 
@@ -596,23 +596,23 @@ class Object(GObjectModule.Object):
 
     # The following methods are static APIs which need to leap frog the
     # gi methods until we verify the gi methods can replace them.
-    get_property = _gobject.GObject.get_property
-    get_properties = _gobject.GObject.get_properties
-    set_property = _gobject.GObject.set_property
-    set_properties = _gobject.GObject.set_properties
-    bind_property = _gobject.GObject.bind_property
-    connect = _gobject.GObject.connect
-    connect_after = _gobject.GObject.connect_after
-    connect_object = _gobject.GObject.connect_object
-    connect_object_after = _gobject.GObject.connect_object_after
-    disconnect_by_func = _gobject.GObject.disconnect_by_func
-    handler_block_by_func = _gobject.GObject.handler_block_by_func
-    handler_unblock_by_func = _gobject.GObject.handler_unblock_by_func
-    emit = _gobject.GObject.emit
-    chain = _gobject.GObject.chain
-    weak_ref = _gobject.GObject.weak_ref
-    __copy__ = _gobject.GObject.__copy__
-    __deepcopy__ = _gobject.GObject.__deepcopy__
+    get_property = _gi.GObject.get_property
+    get_properties = _gi.GObject.get_properties
+    set_property = _gi.GObject.set_property
+    set_properties = _gi.GObject.set_properties
+    bind_property = _gi.GObject.bind_property
+    connect = _gi.GObject.connect
+    connect_after = _gi.GObject.connect_after
+    connect_object = _gi.GObject.connect_object
+    connect_object_after = _gi.GObject.connect_object_after
+    disconnect_by_func = _gi.GObject.disconnect_by_func
+    handler_block_by_func = _gi.GObject.handler_block_by_func
+    handler_unblock_by_func = _gi.GObject.handler_unblock_by_func
+    emit = _gi.GObject.emit
+    chain = _gi.GObject.chain
+    weak_ref = _gi.GObject.weak_ref
+    __copy__ = _gi.GObject.__copy__
+    __deepcopy__ = _gi.GObject.__deepcopy__
 
     def freeze_notify(self):
         """Freezes the object's property-changed notification queue.
@@ -648,9 +648,9 @@ class Object(GObjectModule.Object):
         """
         flags = kwargs.get('connect_flags', 0)
         if flags & GObjectModule.ConnectFlags.AFTER:
-            connect_func = _gobject.GObject.connect_after
+            connect_func = _gi.GObject.connect_after
         else:
-            connect_func = _gobject.GObject.connect
+            connect_func = _gi.GObject.connect
 
         if flags & GObjectModule.ConnectFlags.SWAPPED:
             if len(data) != 1:
index c5b9a39..bf1b9af 100644 (file)
@@ -78,7 +78,6 @@ if hasattr(Gdk, 'Color'):
                          int(green * Color.MAX_VALUE),
                          int(blue * Color.MAX_VALUE))
 
-
     Color = override(Color)
     __all__.append('Color')
 
@@ -322,12 +321,15 @@ __all__.append('DragContext')
 
 
 class Cursor(Gdk.Cursor):
+
     def __new__(cls, *args, **kwds):
         arg_len = len(args)
         kwd_len = len(kwds)
         total_len = arg_len + kwd_len
 
         if total_len == 1:
+            if Gdk._version == "4.0":
+                raise ValueError("Wrong number of parameters")
             # Since g_object_newv (super.__new__) does not seem valid for
             # direct use with GdkCursor, we must assume usage of at least
             # one of the C constructors to be valid.
index bb320a5..cdb3ccb 100644 (file)
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 # USA
 
+import warnings
+
 from ..overrides import override, deprecated_init
 from ..module import get_introspection_module
+from gi import PyGIWarning
 
 from gi.repository import GLib
 
@@ -30,6 +33,22 @@ Gio = get_introspection_module('Gio')
 __all__ = []
 
 
+class VolumeMonitor(Gio.VolumeMonitor):
+
+    def __init__(self, *args, **kwargs):
+        super(VolumeMonitor, self).__init__(*args, **kwargs)
+
+        # https://bugzilla.gnome.org/show_bug.cgi?id=744690
+        warnings.warn(
+            "Gio.VolumeMonitor shouldn't be instantiated directly, "
+            "use Gio.VolumeMonitor.get() instead.",
+            PyGIWarning, stacklevel=2)
+
+
+VolumeMonitor = override(VolumeMonitor)
+__all__.append('VolumeMonitor')
+
+
 class FileEnumerator(Gio.FileEnumerator):
     def __iter__(self):
         return self
index 2c0e870..08d2612 100644 (file)
@@ -30,10 +30,8 @@ from gi import PyGIDeprecationWarning
 
 if sys.version_info >= (3, 0):
     _basestring = str
-    _callable = lambda c: hasattr(c, '__call__')
 else:
     _basestring = basestring
-    _callable = callable
 
 Gtk = get_introspection_module('Gtk')
 
@@ -91,7 +89,7 @@ def _extract_handler_and_args(obj_or_map, handler_name):
         args = handler[1:]
         handler = handler[0]
 
-    elif not _callable(handler):
+    elif not callable(handler):
         raise TypeError('Handler %s is not a method, function or tuple' % handler)
 
     return handler, args
@@ -745,9 +743,6 @@ class TextBuffer(Gtk.TextBuffer):
             self.apply_tag(tag, start, iter)
 
     def insert_with_tags_by_name(self, iter, text, *tags):
-        if not tags:
-            return
-
         tag_objs = []
 
         for tag in tags:
index 6e0976d..61044db 100644 (file)
@@ -89,10 +89,22 @@ build_triplet = @build@
 host_triplet = @host@
 subdir = gi/overrides
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
-       $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
-       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+       $(top_srcdir)/m4/ax_append_flag.m4 \
+       $(top_srcdir)/m4/ax_append_link_flags.m4 \
+       $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+       $(top_srcdir)/m4/ax_check_link_flag.m4 \
+       $(top_srcdir)/m4/ax_code_coverage.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+       $(top_srcdir)/m4/ax_is_release.m4 \
+       $(top_srcdir)/m4/ax_require_defined.m4 \
+       $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
        $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
@@ -157,7 +169,6 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/py-compile
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -180,7 +191,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DLLTOOL = @DLLTOOL@
@@ -213,8 +223,14 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
 INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
 INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
 LCOV = @LCOV@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
@@ -247,14 +263,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
 PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
 PYCAIRO_LIBS = @PYCAIRO_LIBS@
 PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
 PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
 PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
 PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
 PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
 PYTHON_INCLUDES = @PYTHON_INCLUDES@
 PYTHON_LIBS = @PYTHON_LIBS@
@@ -262,15 +276,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
 PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
 VERSION = @VERSION@
 WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
index 942e6ed..e262b6c 100644 (file)
@@ -165,20 +165,6 @@ def load_overrides(introspection_module):
     return proxy
 
 
-class overridefunc(object):
-    """decorator for overriding a function"""
-    def __init__(self, func):
-        if not isinstance(func, CallableInfo):
-            raise TypeError("func must be a gi function, got %s" % func)
-
-        module_name = func.__module__.rsplit('.', 1)[-1]
-        self.module = sys.modules["gi.repository." + module_name]
-
-    def __call__(self, func):
-        setattr(self.module, func.__name__, func)
-        return func
-
-
 def override(type_):
     """Decorator for registering an override.
 
@@ -187,8 +173,18 @@ def override(type_):
     for example), so they have to be added to the module immediately.
     """
 
-    if isinstance(type_, (types.FunctionType, CallableInfo)):
-        return overridefunc(type_)
+    if isinstance(type_, CallableInfo):
+        func = type_
+        namespace = func.__module__.rsplit('.', 1)[-1]
+        module = sys.modules["gi.repository." + namespace]
+
+        def wrapper(func):
+            setattr(module, func.__name__, func)
+            return func
+
+        return wrapper
+    elif isinstance(type_, types.FunctionType):
+        raise TypeError("func must be a gi function, got %s" % type_)
     else:
         try:
             info = getattr(type_, '__info__')
@@ -214,6 +210,10 @@ def override(type_):
         return type_
 
 
+overridefunc = override
+"""Deprecated"""
+
+
 def deprecated(fn, replacement):
     """Decorator for marking methods and classes as deprecated"""
     @wraps(fn)
index 2eaff85..e521c96 100644 (file)
@@ -22,6 +22,7 @@
 #  include <config.h>
 #endif
 
+#include <Python.h>
 #include <glib-object.h>
 
 #include <pyglib.h>
@@ -39,9 +40,9 @@ static void
 pyg_boxed_dealloc(PyGBoxed *self)
 {
     if (self->free_on_dealloc && pyg_boxed_get_ptr (self)) {
-       PyGILState_STATE state = pyglib_gil_state_ensure();
+       PyGILState_STATE state = PyGILState_Ensure();
        g_boxed_free (self->gtype, pyg_boxed_get_ptr (self));
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
     }
 
     Py_TYPE(self)->tp_free((PyObject *)self);
@@ -62,10 +63,10 @@ pyg_boxed_richcompare(PyObject *self, PyObject *other, int op)
 }
 
 
-static long
+static PYGLIB_Py_hash_t
 pyg_boxed_hash(PyGBoxed *self)
 {
-    return (long)pyg_boxed_get_ptr (self);
+    return PYGLIB_Py_hash_t_FromVoidPtr (pyg_boxed_get_ptr (self));
 }
 
 static PyObject *
@@ -203,11 +204,11 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
     g_return_val_if_fail(boxed_type != 0, NULL);
     g_return_val_if_fail(!copy_boxed || (copy_boxed && own_ref), NULL);
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     if (!boxed) {
        Py_INCREF(Py_None);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return Py_None;
     }
 
@@ -221,14 +222,14 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
 
     if (!PyType_IsSubtype (tp, &PyGBoxed_Type)) {
         PyErr_Format (PyExc_RuntimeError, "%s isn't a GBoxed", tp->tp_name);
-        pyglib_gil_state_release (state);
+        PyGILState_Release (state);
         return NULL;
     }
 
     self = (PyGBoxed *)tp->tp_alloc(tp, 0);
 
     if (self == NULL) {
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
         return NULL;
     }
 
@@ -238,7 +239,7 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
     self->gtype = boxed_type;
     self->free_on_dealloc = own_ref;
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     
     return (PyObject *)self;
 }
index cea9c0f..6897d53 100644 (file)
@@ -165,7 +165,7 @@ pyg_enum_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
      * values might not have been that good", but we need to keep
      * backward compatibility.
      */
-    if (!PyDict_Check(values) || PyDict_Size(values) > eclass->n_values) {
+    if (!PyDict_Check(values) || (gsize)PyDict_Size(values) > eclass->n_values) {
        PyErr_SetString(PyExc_TypeError, "__enum_values__ badly formed");
        Py_DECREF(values);
        g_type_class_unref(eclass);
@@ -235,7 +235,7 @@ pyg_enum_add (PyObject *   module,
     PyGILState_STATE state;
     PyObject *instance_dict, *stub, *values, *o;
     GEnumClass *eclass;
-    int i;
+    guint i;
 
     g_return_val_if_fail(typename != NULL, NULL);
     if (!g_type_is_a (gtype, G_TYPE_ENUM)) {
@@ -244,7 +244,7 @@ pyg_enum_add (PyObject *   module,
         return NULL;
     }
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* Create a new type derived from GEnum. This is the same as:
      * >>> stub = type(typename, (GEnum,), {})
@@ -256,7 +256,7 @@ pyg_enum_add (PyObject *   module,
     Py_DECREF(instance_dict);
     if (!stub) {
        PyErr_SetString(PyExc_RuntimeError, "can't create const");
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return NULL;
     }
 
@@ -309,7 +309,7 @@ pyg_enum_add (PyObject *   module,
 
     g_type_class_unref(eclass);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return stub;
 }
 
index 693fca0..fa12341 100644 (file)
@@ -74,7 +74,7 @@ generate_repr(GType gtype, guint value)
 {
     GFlagsClass *flags_class;
     char *retval = NULL, *tmp;
-    int i;
+    guint i;
 
     flags_class = g_type_class_ref(gtype);
     g_assert(G_IS_FLAGS_CLASS(flags_class));
@@ -256,7 +256,7 @@ pyg_flags_add (PyObject *   module,
     PyGILState_STATE state;
     PyObject *instance_dict, *stub, *values, *o;
     GFlagsClass *eclass;
-    int i;
+    guint i;
 
     g_return_val_if_fail(typename != NULL, NULL);
     if (!g_type_is_a(gtype, G_TYPE_FLAGS)) {
@@ -265,7 +265,7 @@ pyg_flags_add (PyObject *   module,
         return NULL;
     }
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* Create a new type derived from GFlags. This is the same as:
      * >>> stub = type(typename, (GFlags,), {})
@@ -277,7 +277,7 @@ pyg_flags_add (PyObject *   module,
     Py_DECREF(instance_dict);
     if (!stub) {
        PyErr_SetString(PyExc_RuntimeError, "can't create GFlags subtype");
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
         return NULL;
     }
 
@@ -329,7 +329,7 @@ pyg_flags_add (PyObject *   module,
 
     g_type_class_unref(eclass);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return stub;
 }
@@ -425,7 +425,7 @@ pyg_flags_get_value_names(PyGFlags *self, void *closure)
 {
   GFlagsClass *flags_class;
   PyObject *retval;
-  int i;
+  guint i;
 
   flags_class = g_type_class_ref(self->gtype);
   g_assert(G_IS_FLAGS_CLASS(flags_class));
@@ -445,7 +445,7 @@ pyg_flags_get_value_nicks(PyGFlags *self, void *closure)
 {
   GFlagsClass *flags_class;
   PyObject *retval;
-  int i;
+  guint i;
 
   flags_class = g_type_class_ref(self->gtype);
   g_assert(G_IS_FLAGS_CLASS(flags_class));
index 0929038..e6f9346 100644 (file)
@@ -19,6 +19,8 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <Python.h>
+
 #include <string.h>
 #include <time.h>
 
@@ -1269,6 +1271,8 @@ _pygi_argument_release (GIArgument   *arg,
             g_slice_free (GError *, arg->v_pointer);
             break;
         }
+        default:
+            break;
     }
 }
 
index 61d0617..8dfab12 100644 (file)
@@ -87,7 +87,7 @@ gi_argument_from_py_ssize_t (GIArgument   *arg_out,
         }
 
     case GI_TYPE_TAG_UINT32:
-        if (size_in >= 0 && size_in <= G_MAXUINT32) {
+        if (size_in >= 0 && (gsize)size_in <= G_MAXUINT32) {
             arg_out->v_uint32 = size_in;
             return TRUE;
         } else {
@@ -185,7 +185,7 @@ _pygi_marshal_from_py_array (PyGIInvokeState   *state,
 {
     PyGIMarshalFromPyFunc from_py_marshaller;
     int i = 0;
-    int success_count = 0;
+    gsize success_count = 0;
     Py_ssize_t length;
     gssize item_size;
     gboolean is_ptr_array;
@@ -360,15 +360,15 @@ err:
             /* Only attempt per item cleanup on pointer items */
             if (sequence_cache->item_cache->is_pointer) {
                 for(j = 0; j < success_count; j++) {
-                    PyObject *py_item = PySequence_GetItem (py_arg, j);
+                    PyObject *py_seq_item = PySequence_GetItem (py_arg, j);
                     cleanup_func (state,
                                   sequence_cache->item_cache,
-                                  py_item,
+                                  py_seq_item,
                                   is_ptr_array ?
                                           g_ptr_array_index ((GPtrArray *)array_, j) :
                                           g_array_index (array_, gpointer, j),
                                   TRUE);
-                    Py_DECREF (py_item);
+                    Py_DECREF (py_seq_item);
                 }
             }
         }
@@ -532,10 +532,10 @@ _pygi_marshal_to_py_array (PyGIInvokeState   *state,
             }
         } else {
             GIArgument *len_arg = &state->args[array_cache->len_arg_index].arg_value;
-            PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (callable_cache,
+            PyGIArgCache *sub_cache = _pygi_callable_cache_get_arg (callable_cache,
                                                                     array_cache->len_arg_index);
 
-            if (!gi_argument_to_gsize (len_arg, &len, arg_cache->type_tag)) {
+            if (!gi_argument_to_gsize (len_arg, &len, sub_cache->type_tag)) {
                 return NULL;
             }
         }
@@ -570,7 +570,7 @@ _pygi_marshal_to_py_array (PyGIInvokeState   *state,
         if (arg->v_pointer == NULL) {
             py_obj = PyList_New (0);
         } else {
-            int i;
+            guint i;
 
             gsize item_size;
             PyGIMarshalToPyFunc item_to_py_marshaller;
@@ -656,7 +656,7 @@ err:
     } else {
         /* clean up unprocessed items */
         if (seq_cache->item_cache->to_py_cleanup != NULL) {
-            int j;
+            guint j;
             PyGIMarshalCleanupFunc cleanup_func = seq_cache->item_cache->to_py_cleanup;
             for (j = processed_items; j < array_->len; j++) {
                 cleanup_func (state,
@@ -832,7 +832,7 @@ pygi_arg_garray_len_arg_setup (PyGIArgCache *arg_cache,
             callable_cache->n_py_args -= 1;
 
             for (i = seq_cache->len_arg_index + 1;
-                   i < _pygi_callable_cache_args_len (callable_cache); i++) {
+                   (gsize)i < _pygi_callable_cache_args_len (callable_cache); i++) {
                 PyGIArgCache *update_cache = _pygi_callable_cache_get_arg (callable_cache, i);
                 if (update_cache == NULL)
                     break;
index 4a5e112..6d4e64e 100644 (file)
@@ -246,53 +246,167 @@ _pygi_marshal_from_py_utf8 (PyObject          *py_arg,
     return TRUE;
 }
 
-static gboolean
-_pygi_marshal_from_py_filename (PyObject          *py_arg,
-                                GIArgument        *arg,
-                                gpointer          *cleanup_data)
+G_GNUC_UNUSED static gboolean
+_pygi_marshal_from_py_filename_unix (PyObject          *py_arg,
+                                     GIArgument        *arg,
+                                     gpointer          *cleanup_data)
 {
-    gchar *string_;
-    GError *error = NULL;
-    PyObject *tmp = NULL;
+    gchar *filename;
 
     if (py_arg == Py_None) {
         arg->v_pointer = NULL;
         return TRUE;
     }
 
-    if (PyUnicode_Check (py_arg)) {
-        tmp = PyUnicode_AsUTF8String (py_arg);
-        if (!tmp)
+    if (PYGLIB_PyBytes_Check (py_arg)) {
+        char *buffer;
+
+        if (PYGLIB_PyBytes_AsStringAndSize (py_arg, &buffer, NULL) == -1)
             return FALSE;
 
-        string_ = PYGLIB_PyBytes_AsString (tmp);
-    }
+        filename = g_strdup (buffer);
+    } else if (PyUnicode_Check (py_arg)) {
+        PyObject *bytes;
+        char *buffer;
+
 #if PY_VERSION_HEX < 0x03000000
-    else if (PyString_Check (py_arg)) {
-        string_ = PyString_AsString (py_arg);
-    }
+        bytes = PyUnicode_AsEncodedString (py_arg, Py_FileSystemDefaultEncoding,
+                                           NULL);
+#else
+        bytes = PyUnicode_EncodeFSDefault (py_arg);
 #endif
-    else {
-        PyErr_Format (PyExc_TypeError, "Must be string, not %s",
+
+        if (!bytes)
+            return FALSE;
+
+        if (PYGLIB_PyBytes_AsStringAndSize (bytes, &buffer, NULL) == -1) {
+            Py_DECREF (bytes);
+            return FALSE;
+        }
+
+        filename = g_strdup (buffer);
+        Py_DECREF (bytes);
+    } else {
+        PyErr_Format (PyExc_TypeError, "Must be bytes, not %s",
                       py_arg->ob_type->tp_name);
         return FALSE;
     }
 
-    arg->v_string = g_filename_from_utf8 (string_, -1, NULL, NULL, &error);
-    Py_XDECREF (tmp);
+    arg->v_string = filename;
+    *cleanup_data = filename;
+    return TRUE;
+}
 
-    if (arg->v_string == NULL) {
-        PyErr_SetString (PyExc_Exception, error->message);
-        g_error_free (error);
-        /* TODO: Convert the error to an exception. */
+G_GNUC_UNUSED static gboolean
+_pygi_marshal_from_py_filename_win32 (PyObject          *py_arg,
+                                      GIArgument        *arg,
+                                      gpointer          *cleanup_data)
+{
+    gchar *filename;
+
+    if (py_arg == Py_None) {
+        arg->v_pointer = NULL;
+        return TRUE;
+    }
+
+#if PY_VERSION_HEX < 0x03000000
+    if (PYGLIB_PyBytes_Check (py_arg)) {
+        char *buffer;
+
+        if (PYGLIB_PyBytes_AsStringAndSize (py_arg, &buffer, NULL) == -1)
+            return FALSE;
+
+        filename = g_strdup (buffer);
+    } else if (PyUnicode_Check (py_arg)) {
+        PyObject *bytes;
+        char *buffer;
+
+        bytes = PyUnicode_AsUTF8String (py_arg);
+        if (!bytes)
+            return FALSE;
+
+        if (PYGLIB_PyBytes_AsStringAndSize (bytes, &buffer, NULL) == -1) {
+            Py_DECREF (bytes);
+            return FALSE;
+        }
+
+        filename = g_strdup (buffer);
+        Py_DECREF (bytes);
+    } else {
+        PyErr_Format (PyExc_TypeError, "Must be unicode, not %s",
+                      py_arg->ob_type->tp_name);
         return FALSE;
     }
+#else
+    if (PYGLIB_PyBytes_Check (py_arg)) {
+        PyObject *uni_arg;
+        gboolean result;
+        char *buffer;
 
-    *cleanup_data = arg->v_string;
+        if (PYGLIB_PyBytes_AsStringAndSize (py_arg, &buffer, NULL) == -1)
+            return FALSE;
+
+        uni_arg = PyUnicode_DecodeFSDefault (buffer);
+        if (!uni_arg)
+            return FALSE;
+        result = _pygi_marshal_from_py_filename_win32 (uni_arg, arg, cleanup_data);
+        Py_DECREF (uni_arg);
+        return result;
+    } else if (PyUnicode_Check (py_arg)) {
+        PyObject *bytes, *temp_uni;
+        char *buffer;
+
+        /* The roundtrip merges lone surrogates, so we get the same output as
+         * with Py 2. Requires 3.4+ because of https://bugs.python.org/issue27971
+         * Separated lone surrogates can occur when concatenating two paths.
+         */
+        bytes = PyUnicode_AsEncodedString (py_arg, "utf-16-le", "surrogatepass");
+        if (!bytes)
+            return FALSE;
+        temp_uni = PyUnicode_FromEncodedObject (bytes, "utf-16-le", "surrogatepass");
+        Py_DECREF (bytes);
+        if (!temp_uni)
+            return FALSE;
+        /* glib uses utf-8, so encode to that and allow surrogates so we can
+         * represent all possible path values
+         */
+        bytes = PyUnicode_AsEncodedString (temp_uni, "utf-8", "surrogatepass");
+        Py_DECREF (temp_uni);
+        if (!bytes)
+            return FALSE;
+
+        if (PYGLIB_PyBytes_AsStringAndSize (bytes, &buffer, NULL) == -1) {
+            Py_DECREF (bytes);
+            return FALSE;
+        }
+
+        filename = g_strdup (buffer);
+        Py_DECREF (bytes);
+    } else {
+        PyErr_Format (PyExc_TypeError, "Must be str, not %s",
+                      py_arg->ob_type->tp_name);
+        return FALSE;
+    }
+#endif
+
+    arg->v_string = filename;
+    *cleanup_data = filename;
     return TRUE;
 }
 
 static gboolean
+_pygi_marshal_from_py_filename (PyObject          *py_arg,
+                                GIArgument        *arg,
+                                gpointer          *cleanup_data)
+{
+#ifdef G_OS_WIN32
+    return _pygi_marshal_from_py_filename_win32 (py_arg, arg, cleanup_data);
+#else
+    return _pygi_marshal_from_py_filename_unix (py_arg, arg, cleanup_data);
+#endif
+}
+
+static gboolean
 _pygi_marshal_from_py_long (PyObject   *object,   /* in */
                             GIArgument *arg,      /* out */
                             GITypeTag   type_tag,
@@ -617,23 +731,23 @@ _pygi_marshal_to_py_utf8 (GIArgument *arg)
 static PyObject *
 _pygi_marshal_to_py_filename (GIArgument *arg)
 {
-    gchar *string = NULL;
-    PyObject *py_obj = NULL;
-    GError *error = NULL;
+    PyObject *py_obj;
 
     if (arg->v_string == NULL) {
         Py_RETURN_NONE;
     }
 
-    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. */
-        return NULL;
-    }
-
-    py_obj = PYGLIB_PyUnicode_FromString (string);
-    g_free (string);
+#if PY_VERSION_HEX < 0x03000000
+    /* On PY2 we return str as is */
+    py_obj = PyString_FromString (arg->v_string);
+#else
+#ifdef G_OS_WIN32
+    py_obj = PyUnicode_DecodeUTF8 (arg->v_string, strlen(arg->v_string),
+                                   "surrogatepass");
+#else
+    py_obj = PyUnicode_DecodeFSDefault (arg->v_string);
+#endif
+#endif
 
     return py_obj;
 }
index 170b242..82a6182 100644 (file)
@@ -428,6 +428,8 @@ pygi_arg_cache_new (GITypeInfo *type_info,
                                                       transfer,
                                                       direction);
            break;
+       default:
+           break;
     }
 
     if (arg_cache != NULL) {
@@ -499,7 +501,7 @@ _callable_cache_generate_args_cache_real (PyGICallableCache *callable_cache,
     callable_cache->user_data_index = -1;
 
     for (i = 0, arg_index = callable_cache->args_offset;
-         arg_index < _pygi_callable_cache_args_len (callable_cache);
+         (gsize)arg_index < _pygi_callable_cache_args_len (callable_cache);
          i++, arg_index++) {
         PyGIArgCache *arg_cache = NULL;
         GIArgInfo *arg_info;
@@ -973,14 +975,16 @@ _function_with_instance_cache_generate_args_cache_real (PyGICallableCache *calla
 {
     GIInterfaceInfo *interface_info;
     PyGIArgCache *instance_cache;
+    GITransfer transfer;
 
     interface_info = g_base_info_get_container ((GIBaseInfo *) callable_info);
+    transfer = g_callable_info_get_instance_ownership_transfer (callable_info);
 
     instance_cache =
         _arg_cache_new_for_interface (interface_info,
                                       NULL,
                                       NULL,
-                                      GI_TRANSFER_NOTHING,
+                                      transfer,
                                       PYGI_DIRECTION_FROM_PYTHON,
                                       callable_cache);
 
@@ -1139,7 +1143,7 @@ pygi_closure_cache_new (GICallableInfo *info)
      *
      * See: https://bugzilla.gnome.org/show_bug.cgi?id=652115
      */
-    for (i = 0; i < _pygi_callable_cache_args_len (callable_cache); i++) {
+    for (i = 0; (gsize)i < _pygi_callable_cache_args_len (callable_cache); i++) {
         PyGIArgCache *arg_cache;
         PyGIArgGArray *garray_cache;
         PyGIArgCache *len_arg_cache;
@@ -1162,7 +1166,7 @@ pygi_closure_cache_new (GICallableInfo *info)
      * do not recognize user_data/data arguments correctly.
      */
     if (callable_cache->user_data_index == -1) {
-        for (i = 0; i < _pygi_callable_cache_args_len (callable_cache); i++) {
+        for (i = 0; (gsize)i < _pygi_callable_cache_args_len (callable_cache); i++) {
             PyGIArgCache *arg_cache;
 
             arg_cache = g_ptr_array_index (callable_cache->args_cache, i);
index a75e358..17b283f 100644 (file)
@@ -204,7 +204,7 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
                                      PyGICallableCache *cache,
                                      void **args)
 {
-    gint i;
+    guint i;
 
     for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
         PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i);
@@ -274,6 +274,9 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
                 }
                 break;
             }
+            case GI_TYPE_TAG_UNICHAR:
+                state[i].arg_value.v_uint32 = * (guint32 *) args[i];
+                break;
             case GI_TYPE_TAG_ERROR:
             case GI_TYPE_TAG_GHASH:
             case GI_TYPE_TAG_GLIST:
@@ -345,7 +348,7 @@ _pygi_closure_convert_arguments (PyGIInvokeState *state,
     gssize n_in_args = 0;
     gssize i;
 
-    for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
+    for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) {
         PyGIArgCache *arg_cache;
 
         arg_cache = g_ptr_array_index (cache->args_cache, i);
@@ -447,7 +450,7 @@ _pygi_closure_set_out_arguments (PyGIInvokeState *state,
         i_py_retval++;
     }
 
-    for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
+    for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) {
         PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i);
 
         if (arg_cache->direction & PYGI_DIRECTION_FROM_PYTHON) {
index 45ca2eb..e3d8838 100644 (file)
@@ -51,7 +51,7 @@ pygi_error_marshal_to_py (GError **error)
     if (*error == NULL)
         return NULL;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     exc_type = PyGError;
     if (exception_table != NULL)
@@ -71,7 +71,7 @@ pygi_error_marshal_to_py (GError **error)
                                           domain,
                                           (*error)->code);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return exc_instance;
 }
@@ -96,14 +96,14 @@ pygi_error_check (GError **error)
     if (*error == NULL)
         return FALSE;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     exc_instance = pygi_error_marshal_to_py (error);
     PyErr_SetObject(PyGError, exc_instance);
     Py_DECREF(exc_instance);
     g_clear_error(error);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return TRUE;
 }
index 8e76529..682cee2 100644 (file)
@@ -21,8 +21,8 @@
  * IN THE SOFTWARE.
  */
 
-#include <cairo.h>
 #include <Python.h>
+#include <cairo.h>
 
 #if PY_VERSION_HEX < 0x03000000
 #include <pycairo.h>
@@ -367,6 +367,49 @@ cairo_pattern_from_gvalue (const GValue *value)
     return PycairoPattern_FromPattern (pattern, NULL);
 }
 
+#if defined(PycairoRegion_Type)
+
+static PyObject *
+cairo_region_to_arg (PyObject        *value,
+                     GIInterfaceInfo *interface_info,
+                     GITransfer       transfer,
+                     GIArgument      *arg)
+{
+    cairo_region_t *region;
+
+    g_assert (transfer == GI_TRANSFER_NOTHING);
+
+    region = ( (PycairoRegion*) value)->region;
+    if (!region) {
+        PyErr_SetString (PyExc_ValueError, "Region instance wrapping a NULL region");
+        return NULL;
+    }
+
+    arg->v_pointer = region;
+    Py_RETURN_NONE;
+}
+
+static PyObject *
+cairo_region_from_arg (GIInterfaceInfo *interface_info,
+                       GITransfer transfer,
+                       gpointer data)
+{
+    cairo_region_t *region = (cairo_region_t*) data;
+
+    if (transfer == GI_TRANSFER_NOTHING)
+        cairo_region_reference (region);
+
+    return PycairoRegion_FromRegion (region);
+}
+
+static PyObject *
+cairo_region_release (GIBaseInfo *base_info,
+                      gpointer    struct_)
+{
+    cairo_region_destroy ( (cairo_region_t*) struct_);
+    Py_RETURN_NONE;
+}
+#endif
 
 static PyMethodDef _gi_cairo_functions[] = { {0,} };
 PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
@@ -406,6 +449,14 @@ PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
                                   cairo_font_options_from_arg,
                                   cairo_font_options_release);
 
+#if defined(PycairoRegion_Type)
+    pygi_register_foreign_struct ("cairo",
+                                  "Region",
+                                  cairo_region_to_arg,
+                                  cairo_region_from_arg,
+                                  cairo_region_release);
+#endif
+
     pyg_register_gtype_custom (CAIRO_GOBJECT_TYPE_CONTEXT,
                                cairo_context_from_gvalue,
                                cairo_context_to_gvalue);
index f74b1e7..84af1ec 100644 (file)
@@ -50,7 +50,7 @@ init_foreign_structs (void)
 static PyGIForeignStruct *
 do_lookup (const gchar *namespace, const gchar *name)
 {
-    gint i;
+    guint i;
     for (i = 0; i < foreign_structs->len; i++) {
         PyGIForeignStruct *foreign_struct = \
                 g_ptr_array_index (foreign_structs, i);
index 9a1b025..1b33e9a 100644 (file)
@@ -1108,6 +1108,8 @@ _pygi_g_type_tag_size (GITypeTag type_tag)
                           "Unable to know the size (assuming %s is not a pointer)",
                           g_type_tag_to_string (type_tag));
             break;
+        default:
+            break;
     }
 
     return size;
@@ -1166,10 +1168,10 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
                     if (g_type_info_is_pointer (type_info)) {
                         size = sizeof (gpointer);
                     } else {
-                        GITypeTag type_tag;
+                        GITypeTag enum_type_tag;
 
-                        type_tag = g_enum_info_get_storage_type ( (GIEnumInfo *) info);
-                        size = _pygi_g_type_tag_size (type_tag);
+                        enum_type_tag = g_enum_info_get_storage_type ( (GIEnumInfo *) info);
+                        size = _pygi_g_type_tag_size (enum_type_tag);
                     }
                     break;
                 case GI_INFO_TYPE_BOXED:
@@ -1207,6 +1209,8 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
         case GI_TYPE_TAG_ERROR:
             size = sizeof (gpointer);
             break;
+        default:
+            break;
     }
 
     return size;
@@ -1429,6 +1433,9 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
                 g_base_info_unref (info);
                 break;
             }
+            default:
+                g_assert_not_reached();
+                break;
         }
 
         g_base_info_unref ( (GIBaseInfo *) field_type_info);
index 619fe40..fd9e474 100644 (file)
@@ -89,7 +89,7 @@ _py_args_combine_and_check_length (PyGICallableCache *cache,
 {
     PyObject *combined_py_args = NULL;
     Py_ssize_t n_py_args, n_py_kwargs, i;
-    guint n_expected_args = cache->n_py_args;
+    gssize n_expected_args = cache->n_py_args;
     GSList *l;
 
     n_py_args = PyTuple_GET_SIZE (py_args);
@@ -107,7 +107,7 @@ _py_args_combine_and_check_length (PyGICallableCache *cache,
     if (cache->user_data_varargs_index < 0 && n_expected_args < n_py_args) {
         char *full_name = pygi_callable_cache_get_full_name (cache);
         PyErr_Format (PyExc_TypeError,
-                      "%.200s() takes exactly %d %sargument%s (%zd given)",
+                      "%.200s() takes exactly %zd %sargument%s (%zd given)",
                       full_name,
                       n_expected_args,
                       n_py_kwargs > 0 ? "non-keyword " : "",
@@ -194,7 +194,7 @@ _py_args_combine_and_check_length (PyGICallableCache *cache,
             } else {
                 char *full_name = pygi_callable_cache_get_full_name (cache);
                 PyErr_Format (PyExc_TypeError,
-                              "%.200s() takes exactly %d %sargument%s (%zd given)",
+                              "%.200s() takes exactly %zd %sargument%s (%zd given)",
                               full_name,
                               n_expected_args,
                               n_py_kwargs > 0 ? "non-keyword " : "",
@@ -414,7 +414,7 @@ _invoke_marshal_in_args (PyGIInvokeState *state, PyGIFunctionCache *function_cac
         return FALSE;
     }
 
-    for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
+    for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) {
         GIArgument *c_arg = &state->args[i].arg_value;
         PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i);
         PyObject *py_arg = NULL;
@@ -511,6 +511,9 @@ _invoke_marshal_in_args (PyGIInvokeState *state, PyGIFunctionCache *function_cac
                 }
 
                 break;
+            default:
+                g_assert_not_reached();
+                break;
         }
 
         if (py_arg == _PyGIDefaultArgPlaceholder) {
index b4d04bc..906be58 100644 (file)
@@ -94,7 +94,7 @@ pygi_marshal_cleanup_args_from_py_marshal_success (PyGIInvokeState   *state,
 {
     gssize i;
 
-    for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) {
+    for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) {
         PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (cache, i);
         PyGIMarshalCleanupFunc cleanup_func = arg_cache->from_py_cleanup;
         gpointer cleanup_data = state->args[i].arg_cleanup_data;
@@ -164,7 +164,7 @@ pygi_marshal_cleanup_args_from_py_parameter_fail (PyGIInvokeState   *state,
 
     state->failed = TRUE;
 
-    for (i = 0; i < _pygi_callable_cache_args_len (cache)  && i <= failed_arg_index; i++) {
+    for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache)  && i <= failed_arg_index; i++) {
         PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (cache, i);
         PyGIMarshalCleanupFunc cleanup_func = arg_cache->from_py_cleanup;
         gpointer cleanup_data = state->args[i].arg_cleanup_data;
index 35a2790..8fd8ee0 100644 (file)
@@ -58,6 +58,12 @@ _pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/
     }
 
     gobj = pygobject_get (py_arg);
+    if (gobj == NULL) {
+        PyErr_Format(PyExc_RuntimeError, "object at %p of type %s is not initialized",
+                     py_arg, Py_TYPE(py_arg)->tp_name);
+        return FALSE;
+    }
+
     if (transfer == GI_TRANSFER_EVERYTHING) {
         /* For transfer everything, add a new ref that the callee will take ownership of.
          * Pythons existing ref to the GObject will be managed with the PyGObject wrapper.
index 19cdb44..9978585 100644 (file)
@@ -258,6 +258,9 @@ pygi_set_property_value (PyGObject *instance,
                 case GI_INFO_TYPE_ENUM:
                     g_value_set_enum (&value, arg.v_int);
                     break;
+                case GI_INFO_TYPE_FLAGS:
+                    g_value_set_flags (&value, arg.v_uint);
+                    break;
                 case GI_INFO_TYPE_INTERFACE:
                 case GI_INFO_TYPE_OBJECT:
                     g_value_set_object (&value, arg.v_pointer);
@@ -348,7 +351,7 @@ pygi_set_property_value (PyGObject *instance,
              */
             GArray *arg_items = (GArray*) arg.v_pointer;
             gchar** strings;
-            int i;
+            guint i;
 
             if (arg_items == NULL)
                 goto out;
index f2698d5..0cdc1e4 100644 (file)
@@ -88,6 +88,7 @@ pygi_signal_closure_marshal(GClosure *closure,
 
     signal_info = ((PyGISignalClosure *)closure)->signal_info;
     n_sig_info_args = g_callable_info_get_n_args(signal_info);
+    g_assert_cmpint (n_sig_info_args, >=, 0);
     /* the first argument to a signal callback is instance,
        but instance is not counted in the introspection data */
     sig_info_highest_arg = n_sig_info_args + 1;
@@ -110,7 +111,7 @@ pygi_signal_closure_marshal(GClosure *closure,
             }
             PyTuple_SetItem(params, i, item);
 
-        } else if (i < sig_info_highest_arg) {
+        } else if (i < (guint)sig_info_highest_arg) {
             GIArgInfo arg_info;
             GITypeInfo type_info;
             GITypeTag type_tag;
index 92e1870..9ba8d6d 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef __PYGI_SIGNAL_CLOSURE_H__
 #define __PYGI_SIGNAL_CLOSURE_H__
 
+#include <Python.h>
 #include <girepository.h>
 #include "pygobject-internal.h"
 
index 154b1cd..5305260 100644 (file)
@@ -45,7 +45,7 @@ pyg_source_prepare(GSource *source, gint *timeout)
     gboolean got_err = TRUE;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     t = PyObject_CallMethod(pysource->obj, "prepare", NULL);
 
@@ -81,7 +81,7 @@ bail:
 
     Py_XDECREF(t);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return ret;
 }
@@ -94,7 +94,7 @@ pyg_source_check(GSource *source)
     gboolean ret;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     t = PyObject_CallMethod(pysource->obj, "check", NULL);
 
@@ -106,7 +106,7 @@ pyg_source_check(GSource *source)
        Py_DECREF(t);
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return ret;
 }
@@ -119,7 +119,7 @@ pyg_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
     gboolean ret;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     if (callback) {
        tuple = user_data;
@@ -141,7 +141,7 @@ pyg_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
        Py_DECREF(t);
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return ret;
 }
@@ -153,7 +153,7 @@ pyg_source_finalize(GSource *source)
     PyObject *func, *t;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     func = PyObject_GetAttrString(pysource->obj, "finalize");
     if (func) {
@@ -165,9 +165,11 @@ pyg_source_finalize(GSource *source)
        } else {
            Py_DECREF(t);
        }
+    } else {
+        PyErr_Clear ();
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 static GSourceFuncs pyg_source_funcs =
index a4276a4..60d2585 100644 (file)
@@ -125,9 +125,8 @@ pygi_arg_gvalue_from_py_marshal (PyObject *py_arg,
     } else {
         value = g_slice_new0 (GValue);
         g_value_init (value, object_type);
-        if (pyg_value_from_pyobject (value, py_arg) < 0) {
+        if (pyg_value_from_pyobject_with_error (value, py_arg) < 0) {
             g_slice_free (GValue, value);
-            PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GValue failed");
             return FALSE;
         }
     }
index c7a6ca7..c7bc1d5 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __PYGI_UTIL_H__
 #define __PYGI_UTIL_H__
 
+#include <Python.h>
 #include <glib.h>
 #include "pygobject-internal.h"
 #include <pyglib-python-compat.h>
index 88faf63..443597c 100644 (file)
@@ -157,6 +157,8 @@ _pygi_argument_from_g_value(const GValue *value,
         case GI_TYPE_TAG_VOID:
             arg.v_pointer = g_value_get_pointer (value);
             break;
+        default:
+            break;
     }
 
     return arg;
@@ -173,15 +175,16 @@ pyg_value_array_from_pyobject(GValue *value,
                               PyObject *obj,
                               const GParamSpecValueArray *pspec)
 {
-    int len;
+    Py_ssize_t seq_len;
     GValueArray *value_array;
-    int i;
+    guint len, i;
 
-    len = PySequence_Length(obj);
-    if (len == -1) {
+    seq_len = PySequence_Length(obj);
+    if (seq_len == -1) {
         PyErr_Clear();
         return -1;
     }
+    len = (guint)seq_len;
 
     if (pspec && pspec->fixed_n_elements > 0 && len != pspec->fixed_n_elements)
         return -1;
@@ -383,8 +386,17 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj)
         g_value_set_boolean(value, PyObject_IsTrue(obj));
         break;
     case G_TYPE_INT:
-        g_value_set_int(value, PYGLIB_PyLong_AsLong(obj));
+    {
+        glong val = PYGLIB_PyLong_AsLong(obj);
+        if (val == -1 && PyErr_Occurred ())
+            return -1;
+        if (val > G_MAXINT || val < G_MININT) {
+            PyErr_SetString(PyExc_OverflowError, "out of range for int property");
+            return -1;
+        }
+        g_value_set_int(value, (gint)val);
         break;
+    }
     case G_TYPE_UINT:
     {
         if (PYGLIB_PyLong_Check(obj)) {
@@ -567,7 +579,7 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj)
         break;
     }
     case G_TYPE_PARAM:
-        /* we need to support both the wrapped _gobject.GParamSpec and the GI
+        /* we need to support both the wrapped _gi.GParamSpec and the GI
          * GObject.ParamSpec */
         if (G_IS_PARAM_SPEC (pygobject_get (obj)))
             g_value_set_param(value, G_PARAM_SPEC (pygobject_get (obj)));
index ce2e902..5b2eac1 100644 (file)
@@ -18,9 +18,9 @@
 #ifndef __PYGI_VALUE_H__
 #define __PYGI_VALUE_H__
 
+#include <Python.h>
 #include <glib-object.h>
 #include <girepository.h>
-#include <Python.h>
 
 G_BEGIN_DECLS
 
index 7b67d55..d6f7553 100644 (file)
@@ -54,6 +54,7 @@
 #define PYGLIB_PyBytes_FromStringAndSize PyString_FromStringAndSize
 #define PYGLIB_PyBytes_Resize _PyString_Resize
 #define PYGLIB_PyBytes_AsString PyString_AsString
+#define PYGLIB_PyBytes_AsStringAndSize PyString_AsStringAndSize
 #define PYGLIB_PyBytes_Size PyString_Size
 #define PYGLIB_PyBytes_Check PyString_Check
 
@@ -68,6 +69,8 @@
 #define PYGLIB_PyLong_AS_LONG PyInt_AS_LONG
 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
 
+#define PYGLIB_Py_hash_t long
+
 /* Python 2.7 lacks a PyInt_FromUnsignedLong function; use signed longs, and
  * rely on PyInt_AsUnsignedLong() to interpret them correctly */
 #define PYGLIB_PyLong_FromUnsignedLong PyInt_FromLong
@@ -187,11 +190,16 @@ PyTypeObject symbol = {                                 \
 #define PYGLIB_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
 #define PYGLIB_PyBytes_Resize(o, len) _PyBytes_Resize(o, len)
 #define PYGLIB_PyBytes_AsString PyBytes_AsString
+#define PYGLIB_PyBytes_AsStringAndSize PyBytes_AsStringAndSize
 #define PYGLIB_PyBytes_Size PyBytes_Size
 #define PYGLIB_PyBytes_Check PyBytes_Check
 
 #define PYGLIB_PyNumber_Long PyNumber_Long
 
+#define PYGLIB_Py_hash_t Py_hash_t
+
 #endif
 
+#define PYGLIB_Py_hash_t_FromVoidPtr(ptr) ((PYGLIB_Py_hash_t)(gintptr)(ptr))
+
 #endif /* __PYGLIB_PYTHON_COMPAT_H__ */
index b83d605..d21ba4d 100644 (file)
@@ -79,9 +79,9 @@ _pyglib_destroy_notify(gpointer user_data)
     PyObject *obj = (PyObject *)user_data;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_DECREF(obj);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 gboolean
@@ -93,7 +93,7 @@ _pyglib_handler_marshal(gpointer user_data)
 
     g_return_val_if_fail(user_data != NULL, FALSE);
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     tuple = (PyObject *)user_data;
     ret = PyObject_CallObject(PyTuple_GetItem(tuple, 0),
@@ -106,7 +106,7 @@ _pyglib_handler_marshal(gpointer user_data)
        Py_DECREF(ret);
     }
     
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return res;
 }
index 37bdfa5..d390f14 100644 (file)
@@ -31,14 +31,6 @@ G_BEGIN_DECLS
 typedef void (*PyGLibThreadsEnabledFunc) (void);
 typedef void (*PyGLibThreadBlockFunc) (void);
 
-#ifdef DISABLE_THREADING
-#    define pyglib_gil_state_ensure()        PyGILState_LOCKED
-#    define pyglib_gil_state_release(state)  state
-#else
-#    define pyglib_gil_state_ensure          PyGILState_Ensure
-#    define pyglib_gil_state_release         PyGILState_Release
-#endif
-
 GOptionGroup * pyglib_option_group_transfer_group(PyObject *self);
 
 /* Private: for gobject <-> glib interaction only. */
index b2fe471..ca82ffb 100644 (file)
@@ -112,7 +112,7 @@ pygobject_data_free(PyGObjectData *data)
 
     if (Py_IsInitialized()) {
        state_saved = TRUE;
-       state = pyglib_gil_state_ensure();
+       state = PyGILState_Ensure();
        Py_DECREF(data->type);
        /* We cannot use Py_BEGIN_ALLOW_THREADS here because this is inside
         * a branch. */
@@ -140,7 +140,7 @@ pygobject_data_free(PyGObjectData *data)
 
     if (state_saved && Py_IsInitialized ()) {
        Py_BLOCK_THREADS; /* Restores _save */
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
     }
 }
 
@@ -206,7 +206,7 @@ typedef struct {
     guint index;
 } PyGPropsIter;
 
-PYGLIB_DEFINE_TYPE("gi._gobject.GPropsIter", PyGPropsIter_Type, PyGPropsIter);
+PYGLIB_DEFINE_TYPE("gi._gi.GPropsIter", PyGPropsIter_Type, PyGPropsIter);
 
 static void
 pyg_props_iter_dealloc(PyGPropsIter *self)
@@ -351,7 +351,7 @@ set_property_from_pspec(GObject *obj,
     return TRUE;
 }
 
-PYGLIB_DEFINE_TYPE("gi._gobject.GProps", PyGProps_Type, PyGProps);
+PYGLIB_DEFINE_TYPE("gi._gi.GProps", PyGProps_Type, PyGProps);
 
 static int
 PyGProps_setattro(PyGProps *self, PyObject *attr, PyObject *pvalue)
@@ -477,7 +477,7 @@ static PySequenceMethods _PyGProps_as_sequence = {
     0
 };
 
-PYGLIB_DEFINE_TYPE("gi._gobject.GPropsDescr", PyGPropsDescr_Type, PyObject);
+PYGLIB_DEFINE_TYPE("gi._gi.GPropsDescr", PyGPropsDescr_Type, PyObject);
 
 static PyObject *
 pyg_props_descr_descr_get(PyObject *self, PyObject *obj, PyObject *type)
@@ -606,7 +606,7 @@ pyg_toggle_notify (gpointer data, GObject *object, gboolean is_last_ref)
     PyGObject *self;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* Avoid thread safety problems by using qdata for wrapper retrieval
      * instead of the user data argument.
@@ -620,7 +620,7 @@ pyg_toggle_notify (gpointer data, GObject *object, gboolean is_last_ref)
             Py_INCREF(self);
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
   /* Called when the inst_dict is first created; switches the 
@@ -701,7 +701,7 @@ pyg_type_get_bases(GType gtype)
     guint n_interfaces;
     PyTypeObject *py_parent_type, *py_interface_type;
     PyObject *bases;
-    int i;
+    guint i;
     
     if (G_UNLIKELY(gtype == G_TYPE_OBJECT))
         return NULL;
@@ -747,7 +747,7 @@ pygobject_new_with_interfaces(GType gtype)
     PyTypeObject *py_parent_type;
     PyObject *bases;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     bases = pyg_type_get_bases(gtype);
     py_parent_type = (PyTypeObject *) PyTuple_GetItem(bases, 0);
@@ -772,7 +772,7 @@ pygobject_new_with_interfaces(GType gtype)
 
     if (type == NULL) {
        PyErr_Print();
-        pyglib_gil_state_release(state);
+        PyGILState_Release(state);
        return NULL;
     }
 
@@ -797,7 +797,7 @@ pygobject_new_with_interfaces(GType gtype)
 
     if (PyType_Ready(type) < 0) {
        g_warning ("couldn't make the type `%s' ready", type->tp_name);
-        pyglib_gil_state_release(state);
+        PyGILState_Release(state);
        return NULL;
     }
 
@@ -805,7 +805,7 @@ pygobject_new_with_interfaces(GType gtype)
     Py_INCREF(type);
     g_type_set_qdata(gtype, pygobject_class_key, type);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return type;
 }
@@ -847,7 +847,7 @@ pygobject_inherit_slots(PyTypeObject *type, PyObject *bases, gboolean check_for_
                                   offsetof(PyTypeObject, tp_repr),
                                   offsetof(PyTypeObject, tp_str),
                                   offsetof(PyTypeObject, tp_print) };
-    int i;
+    gsize i;
 
     /* Happens when registering gobject.GObject itself, at least. */
     if (!bases)
@@ -913,6 +913,8 @@ pygobject_find_slot_for(PyTypeObject *type, PyObject *bases, int slot_offset,
  * or interface has been registered for the given GType, then a new
  * type will be created.
  *
+ * Does not set an exception when NULL is returned.
+ *
  * Returns: The wrapper class for the GObject or NULL if the
  *          GType has no registered type and a new type couldn't be created
  */
@@ -922,19 +924,22 @@ pygobject_lookup_class(GType gtype)
     PyTypeObject *py_type;
 
     if (gtype == G_TYPE_INTERFACE)
-       return &PyGInterface_Type;
+        return &PyGInterface_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);
+        py_type = g_type_get_qdata(gtype, pyginterface_type_key);
 
-    if (py_type == NULL)
-        py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype);
+        if (py_type == NULL) {
+            py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype);
+            PyErr_Clear ();
+        }
 
-       if (py_type == NULL) {
-           py_type = pygobject_new_with_interfaces(gtype);
-           g_type_set_qdata(gtype, pyginterface_type_key, py_type);
-       }
+        if (py_type == NULL) {
+            py_type = pygobject_new_with_interfaces(gtype);
+            PyErr_Clear ();
+            g_type_set_qdata(gtype, pyginterface_type_key, py_type);
+        }
     }
     
     return py_type;
@@ -1067,7 +1072,7 @@ pygobject_watch_closure(PyObject *self, GClosure *closure)
 
 /* -------------- PyGObject behaviour ----------------- */
 
-PYGLIB_DEFINE_TYPE("gi._gobject.GObject", PyGObject_Type, PyGObject);
+PYGLIB_DEFINE_TYPE("gi._gi.GObject", PyGObject_Type, PyGObject);
 
 static void
 pygobject_dealloc(PyGObject *self)
@@ -1115,10 +1120,10 @@ pygobject_richcompare(PyObject *self, PyObject *other, int op)
                                            op);
 }
 
-static long
+static PYGLIB_Py_hash_t
 pygobject_hash(PyGObject *self)
 {
-    return (long)self->obj;
+    return PYGLIB_Py_hash_t_FromVoidPtr (self->obj);
 }
 
 static PyObject *
@@ -1459,10 +1464,10 @@ pygbinding_closure_invalidate(gpointer data, GClosure *closure)
     PyGClosure *pc = (PyGClosure *)closure;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_XDECREF(pc->callback);
     Py_XDECREF(pc->extra_args);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     pc->callback = NULL;
     pc->extra_args = NULL;
@@ -1481,7 +1486,7 @@ pygbinding_marshal (GClosure     *closure,
     PyObject *params, *ret;
     GValue *out_value;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* construct Python tuple for the parameter values */
     params = PyTuple_New(2);
@@ -1516,7 +1521,7 @@ pygbinding_marshal (GClosure     *closure,
 
 out:
     Py_DECREF(params);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 static GClosure *
@@ -1837,7 +1842,7 @@ pygobject_emit(PyGObject *self, PyObject *args)
        return NULL;
     }
     g_signal_query(signal_id, &query);
-    if (len != query.n_params + 1) {
+    if ((gsize)len != query.n_params + 1) {
        gchar buf[128];
 
        g_snprintf(buf, sizeof(buf),
@@ -1922,7 +1927,7 @@ pygobject_chain_from_overridden(PyGObject *self, PyObject *args)
        return NULL;
     }
     g_signal_query(signal_id, &query);
-    if (len != query.n_params) {
+    if (len < 0 || (gsize)len != query.n_params) {
        gchar buf[128];
 
        g_snprintf(buf, sizeof(buf),
@@ -2201,7 +2206,7 @@ typedef struct {
     gboolean have_floating_ref;
 } PyGObjectWeakRef;
 
-PYGLIB_DEFINE_TYPE("gi._gobject.GObjectWeakRef", PyGObjectWeakRef_Type, PyGObjectWeakRef);
+PYGLIB_DEFINE_TYPE("gi._gi.GObjectWeakRef", PyGObjectWeakRef_Type, PyGObjectWeakRef);
 
 static int
 pygobject_weak_ref_traverse(PyGObjectWeakRef *self, visitproc visit, void *arg)
@@ -2219,7 +2224,7 @@ pygobject_weak_ref_notify(PyGObjectWeakRef *self, GObject *dummy)
     self->obj = NULL;
     if (self->callback) {
         PyObject *retval;
-        PyGILState_STATE state = pyglib_gil_state_ensure();
+        PyGILState_STATE state = PyGILState_Ensure();
         retval = PyObject_Call(self->callback, self->user_data, NULL);
         if (retval) {
             if (retval != Py_None)
@@ -2237,7 +2242,7 @@ pygobject_weak_ref_notify(PyGObjectWeakRef *self, GObject *dummy)
             self->have_floating_ref = FALSE;
             Py_DECREF((PyObject *) self);
         }
-        pyglib_gil_state_release(state);
+        PyGILState_Release(state);
     }
 }
 
@@ -2326,9 +2331,9 @@ pyobject_copy(gpointer boxed)
     PyObject *object = boxed;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_INCREF(object);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return object;
 }
 
@@ -2338,9 +2343,9 @@ pyobject_free(gpointer boxed)
     PyObject *object = boxed;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_DECREF(object);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 void
@@ -2405,7 +2410,7 @@ pygobject_object_register_types(PyObject *d)
     descr = PyObject_New(PyObject, &PyGPropsDescr_Type);
     PyDict_SetItemString(PyGObject_Type.tp_dict, "props", descr);
     PyDict_SetItemString(PyGObject_Type.tp_dict, "__module__",
-                        o=PYGLIB_PyUnicode_FromString("gi._gobject._gobject"));
+                        o=PYGLIB_PyUnicode_FromString("gi._gi"));
     Py_DECREF(o);
 
     /* GPropsIter */
index 9e45dde..3762429 100644 (file)
@@ -208,21 +208,12 @@ struct _PyGObject_Functions {
 };
 
 
-#ifdef DISABLE_THREADING
-#    define pyg_threads_enabled           FALSE
-#    define pyg_gil_state_ensure()        0
-#    define pyg_gil_state_release(state)
-#    define pyg_begin_allow_threads       G_STMT_START {
-#    define pyg_end_allow_threads         } G_STMT_END
-#else
-#    define pyg_threads_enabled           TRUE
-#    define pyg_gil_state_ensure          PyGILState_Ensure
-#    define pyg_gil_state_release         PyGILState_Release
-#    define pyg_begin_allow_threads       Py_BEGIN_ALLOW_THREADS
-#    define pyg_end_allow_threads         Py_END_ALLOW_THREADS
-#endif
-
 /* Deprecated, only available for API compatibility. */
+#define pyg_threads_enabled           TRUE
+#define pyg_gil_state_ensure          PyGILState_Ensure
+#define pyg_gil_state_release         PyGILState_Release
+#define pyg_begin_allow_threads       Py_BEGIN_ALLOW_THREADS
+#define pyg_end_allow_threads         Py_END_ALLOW_THREADS
 #define pyg_enable_threads()
 #define pyg_set_thread_block_funcs(a, b)
 #define pyg_block_threads()
index 3b2babd..50c32fb 100644 (file)
@@ -26,7 +26,7 @@
 #include "pygoptioncontext.h"
 #include "pygi-error.h"
 
-PYGLIB_DEFINE_TYPE("gi._glib.OptionContext", PyGOptionContext_Type, PyGOptionContext)
+PYGLIB_DEFINE_TYPE("gi._gi.OptionContext", PyGOptionContext_Type, PyGOptionContext)
 
 /**
  * pyg_option_context_new:
@@ -56,7 +56,7 @@ pyg_option_context_init(PyGOptionContext *self,
 {
     char *parameter_string;
 
-    if (!PyArg_ParseTuple(args, "s:gi._glib.GOptionContext.__init__",
+    if (!PyArg_ParseTuple(args, "s:gi._gi.GOptionContext.__init__",
                           &parameter_string))
         return -1;
 
index bd57489..e91ca05 100644 (file)
@@ -26,7 +26,7 @@
 #include "pygoptiongroup.h"
 #include "pygi-error.h"
 
-PYGLIB_DEFINE_TYPE("gi._glib.OptionGroup", PyGOptionGroup_Type, PyGOptionGroup)
+PYGLIB_DEFINE_TYPE("gi._gi.OptionGroup", PyGOptionGroup_Type, PyGOptionGroup)
 
 /**
  * pyg_option_group_new:
@@ -60,7 +60,7 @@ check_if_owned(PyGOptionGroup *self)
     if (self->other_owner)
     {
         PyErr_SetString(PyExc_ValueError, "The GOptionGroup was not created by "
-                        "gi._glib.OptionGroup(), so operation is not possible.");
+                        "gi._gi.OptionGroup(), so operation is not possible.");
         return TRUE;
     }
     return FALSE;
@@ -70,7 +70,7 @@ static void
 destroy_g_group(PyGOptionGroup *self)
 {
     PyGILState_STATE state;
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     self->group = NULL;
     Py_CLEAR(self->callback);
@@ -83,7 +83,7 @@ destroy_g_group(PyGOptionGroup *self)
         Py_DECREF(self);
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 static int
@@ -137,8 +137,7 @@ arg_func(const gchar *option_name,
     PyGILState_STATE state;
     gboolean no_error;
 
-    state = pyglib_gil_state_ensure();
-
+    state = PyGILState_Ensure();
     if (value == NULL)
         ret = PyObject_CallFunction(self->callback, "sOO",
                                     option_name, Py_None, self);
@@ -153,7 +152,7 @@ arg_func(const gchar *option_name,
     } else
        no_error = pygi_gerror_exception_check(error) != -1;
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return no_error;
 }
 
index 0982b99..4ace96c 100644 (file)
@@ -46,10 +46,10 @@ pyg_param_spec_richcompare(PyObject *self, PyObject *other, int op)
     }
 }
 
-static long
+static PYGLIB_Py_hash_t
 pyg_param_spec_hash(PyGParamSpec *self)
 {
-    return (long)pyg_param_spec_get (self);
+    return PYGLIB_Py_hash_t_FromVoidPtr (pyg_param_spec_get (self));
 }
 
 static PyObject *
index 64ca983..dccd303 100644 (file)
@@ -53,10 +53,10 @@ pyg_pointer_richcompare(PyObject *self, PyObject *other, int op)
     }
 }
 
-static long
+static PYGLIB_Py_hash_t
 pyg_pointer_hash(PyGPointer *self)
 {
-    return (long)pyg_pointer_get_ptr (self);
+    return PYGLIB_Py_hash_t_FromVoidPtr (pyg_pointer_get_ptr (self));
 }
 
 static PyObject *
@@ -64,8 +64,9 @@ pyg_pointer_repr(PyGPointer *self)
 {
     gchar buf[128];
 
-    g_snprintf(buf, sizeof(buf), "<%s at 0x%lx>", g_type_name(self->gtype),
-              (long)pyg_pointer_get_ptr (self));
+    g_snprintf(buf, sizeof(buf), "<%s at 0x%" G_GUINTPTR_FORMAT ">",
+               g_type_name(self->gtype),
+               (guintptr)pyg_pointer_get_ptr (self));
     return PYGLIB_PyUnicode_FromString(buf);
 }
 
@@ -153,11 +154,11 @@ pyg_pointer_new(GType pointer_type, gpointer pointer)
     PyTypeObject *tp;
     g_return_val_if_fail(pointer_type != 0, NULL);
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     if (!pointer) {
        Py_INCREF(Py_None);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return Py_None;
     }
 
@@ -170,7 +171,7 @@ pyg_pointer_new(GType pointer_type, gpointer pointer)
        tp = (PyTypeObject *)&PyGPointer_Type; /* fallback */
     self = PyObject_NEW(PyGPointer, tp);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     if (self == NULL)
        return NULL;
index c66c50f..7828d23 100644 (file)
@@ -32,12 +32,22 @@ struct _PyGChildSetupData {
     PyObject *data;
 };
 
-PYGLIB_DEFINE_TYPE("gi._glib.Pid", PyGPid_Type, PYGLIB_PyLongObject)
+PYGLIB_DEFINE_TYPE("gi._gi.Pid", PyGPid_Type, PYGLIB_PyLongObject)
+
+static GPid
+pyg_pid_get_pid (PyObject *self)
+{
+#ifdef G_OS_WIN32
+    return (GPid)PyLong_AsVoidPtr (self);
+#else
+    return (GPid)PYGLIB_PyLong_AsLong (self);
+#endif
+}
 
 static PyObject *
 pyg_pid_close(PyObject *self, PyObject *args, PyObject *kwargs)
 {
-    g_spawn_close_pid(PYGLIB_PyLong_AsLong(self));
+    g_spawn_close_pid(pyg_pid_get_pid (self));
     Py_INCREF(Py_None);
     return Py_None;
 }
@@ -50,22 +60,28 @@ static PyMethodDef pyg_pid_methods[] = {
 static void
 pyg_pid_free(PyObject *gpid)
 {
-    g_spawn_close_pid((GPid) PYGLIB_PyLong_AsLong(gpid));
+    g_spawn_close_pid(pyg_pid_get_pid (gpid));
     PYGLIB_PyLong_Type.tp_free((void *) gpid);
 }
 
 static int
 pyg_pid_tp_init(PyObject *self, PyObject *args, PyObject *kwargs)
 {
-    PyErr_SetString(PyExc_TypeError, "gi._glib.Pid cannot be manually instantiated");
+    PyErr_SetString(PyExc_TypeError, "gi._gi.Pid cannot be manually instantiated");
     return -1;
 }
 
 PyObject *
 pyg_pid_new(GPid pid)
 {
-    return PyObject_CallMethod((PyObject*)&PyGPid_Type, "__new__", "Oi",
-                              &PyGPid_Type, pid);
+    PyObject *long_val;
+#ifdef G_OS_WIN32
+    long_val = PyLong_FromVoidPtr (pid);
+#else
+    long_val = PYGLIB_PyLong_FromLong (pid);
+#endif
+    return PyObject_CallMethod((PyObject*)&PyGPid_Type, "__new__", "ON",
+                               &PyGPid_Type, long_val);
 }
 
 static void
@@ -76,7 +92,7 @@ _pyg_spawn_async_callback(gpointer user_data)
     PyGILState_STATE gil;
 
     data = (struct _PyGChildSetupData *) user_data;
-    gil = pyglib_gil_state_ensure();
+    gil = PyGILState_Ensure();
     if (data->data)
         retval = PyObject_CallFunction(data->func, "O", data->data);
     else
@@ -88,7 +104,7 @@ _pyg_spawn_async_callback(gpointer user_data)
     Py_DECREF(data->func);
     Py_XDECREF(data->data);
     g_slice_free(struct _PyGChildSetupData, data);
-    pyglib_gil_state_release(gil);
+    PyGILState_Release(gil);
 }
 
 PyObject *
@@ -106,10 +122,10 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
     gint *standard_input, *standard_output, *standard_error;
     struct _PyGChildSetupData *callback_data = NULL;
     GError *error = NULL;
-    GPid child_pid = -1;
+    GPid child_pid = 0;
     Py_ssize_t len, i;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OsiOOOOO:gi._glib.spawn_async",
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OsiOOOOO:gi._gi.spawn_async",
                                      kwlist,
                                      &pyargv, &pyenvp, &working_directory, &flags,
                                      &func, &user_data,
@@ -134,7 +150,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
       /* parse argv */
     if (!PySequence_Check(pyargv)) {
         PyErr_SetString(PyExc_TypeError,
-                        "gi._glib.spawn_async: "
+                        "gi._gi.spawn_async: "
                        "first argument must be a sequence of strings");
         return NULL;
     }
@@ -144,7 +160,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
         PyObject *tmp = PySequence_ITEM(pyargv, i);
         if (tmp == NULL || !PYGLIB_PyUnicode_Check(tmp)) {
             PyErr_SetString(PyExc_TypeError,
-                            "gi._glib.spawn_async: "
+                            "gi._gi.spawn_async: "
                            "first argument must be a sequence of strings");
             g_free(argv);
             Py_XDECREF(tmp);
@@ -158,7 +174,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
     if (pyenvp) {
         if (!PySequence_Check(pyenvp)) {
             PyErr_SetString(PyExc_TypeError,
-                            "gi._glib.spawn_async: "
+                            "gi._gi.spawn_async: "
                            "second argument must be a sequence of strings");
             g_free(argv);
             return NULL;
@@ -169,7 +185,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs)
             PyObject *tmp = PySequence_ITEM(pyenvp, i);
             if (tmp == NULL || !PYGLIB_PyUnicode_Check(tmp)) {
                 PyErr_SetString(PyExc_TypeError,
-                                "gi._glib.spawn_async: "
+                                "gi._gi.spawn_async: "
                                "second argument must be a sequence of strings");
                 g_free(envp);
                 Py_XDECREF(tmp);
index 32132ad..85a6d82 100644 (file)
@@ -670,11 +670,11 @@ pyg_closure_invalidate(gpointer data, GClosure *closure)
     PyGClosure *pc = (PyGClosure *)closure;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_XDECREF(pc->callback);
     Py_XDECREF(pc->extra_args);
     Py_XDECREF(pc->swap_data);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     pc->callback = NULL;
     pc->extra_args = NULL;
@@ -694,7 +694,7 @@ pyg_closure_marshal(GClosure *closure,
     PyObject *params, *ret;
     guint i;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* construct Python tuple for the parameter values */
     params = PyTuple_New(n_param_values);
@@ -754,7 +754,7 @@ pyg_closure_marshal(GClosure *closure,
 
  out:
     Py_DECREF(params);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 /**
@@ -847,7 +847,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
     PyObject *params, *ret;
     guint i, len;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     g_return_if_fail(invocation_hint != NULL);
     /* get the object passed as the first argument to the closure */
@@ -873,7 +873,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
     if (!method) {
        PyErr_Clear();
        Py_DECREF(object_wrapper);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return;
     }
     Py_DECREF(object_wrapper);
@@ -887,7 +887,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
        /* error condition */
        if (!item) {
            Py_DECREF(params);
-           pyglib_gil_state_release(state);
+           PyGILState_Release(state);
            return;
        }
        PyTuple_SetItem(params, i - 1, item);
@@ -915,7 +915,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
        PyErr_Print();
        Py_DECREF(method);
        Py_DECREF(params);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return;
     }
     Py_DECREF(method);
@@ -923,7 +923,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
     if (G_IS_VALUE(return_value))
        pyg_value_from_pyobject(return_value, ret);
     Py_DECREF(ret);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 /**
index 82c2523..7caf77c 100644 (file)
@@ -21,8 +21,8 @@
 #ifndef __PYGOBJECT_TYPE_H__ 
 #define __PYGOBJECT_TYPE_H__
 
-#include <glib-object.h>
 #include <Python.h>
+#include <glib-object.h>
 #include "pygobject-internal.h"
 
 #define PYGOBJECT_REGISTER_GTYPE(d, type, name, gtype)      \
index 08de64c..91d8e17 100644 (file)
@@ -89,10 +89,22 @@ build_triplet = @build@
 host_triplet = @host@
 subdir = gi/repository
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
-       $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
-       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+       $(top_srcdir)/m4/ax_append_flag.m4 \
+       $(top_srcdir)/m4/ax_append_link_flags.m4 \
+       $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+       $(top_srcdir)/m4/ax_check_link_flag.m4 \
+       $(top_srcdir)/m4/ax_code_coverage.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+       $(top_srcdir)/m4/ax_is_release.m4 \
+       $(top_srcdir)/m4/ax_require_defined.m4 \
+       $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
        $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
@@ -157,7 +169,6 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/py-compile
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -180,7 +191,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DLLTOOL = @DLLTOOL@
@@ -213,8 +223,14 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
 INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
 INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
 LCOV = @LCOV@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
@@ -247,14 +263,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
 PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
 PYCAIRO_LIBS = @PYCAIRO_LIBS@
 PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
 PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
 PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
 PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
 PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
 PYTHON_INCLUDES = @PYTHON_INCLUDES@
 PYTHON_LIBS = @PYTHON_LIBS@
@@ -262,15 +276,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
 PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
 VERSION = @VERSION@
 WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
index 9d3cb0c..9bc3779 100644 (file)
@@ -35,11 +35,10 @@ from ._gi import \
     VFuncInfo, \
     register_interface_info, \
     hook_up_vfunc_implementation, \
-    _gobject
+    GInterface
+from . import _gi
 
-GInterface = _gobject.GInterface
-
-StructInfo  # pyflakes
+StructInfo, GInterface  # pyflakes
 
 from . import _propertyhelper as propertyhelper
 from . import _signalhelper as signalhelper
@@ -147,7 +146,7 @@ def find_vfunc_info_in_interface(bases, vfunc_name):
         # This can be seen in IntrospectionModule.__getattr__() in module.py.
         # We do not need to search regular classes here, only wrapped interfaces.
         # We also skip GInterface, because it is not wrapped and has no __info__ attr.
-        # Skip bases without __info__ (static _gobject._gobject.GObject)
+        # Skip bases without __info__ (static _gi.GObject)
         if base is GInterface or\
                 not issubclass(base, GInterface) or\
                 not hasattr(base, '__info__'):
@@ -202,10 +201,10 @@ class _GObjectMetaBase(type):
         if cls.__module__.startswith('gi.overrides.'):
             return
 
-        _gobject.type_register(cls, namespace.get('__gtype_name__'))
+        _gi.type_register(cls, namespace.get('__gtype_name__'))
 
 
-_gobject._install_metaclass(_GObjectMetaBase)
+_gi._install_metaclass(_GObjectMetaBase)
 
 
 class GObjectMeta(_GObjectMetaBase, MetaClassHelper):
diff --git a/m4/as-ac-expand.m4 b/m4/as-ac-expand.m4
deleted file mode 100644 (file)
index 0c71173..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
-dnl
-dnl example
-dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
-dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
-
-AC_DEFUN([AS_AC_EXPAND],
-[
-  EXP_VAR=[$1]
-  FROM_VAR=[$2]
-
-  dnl first expand prefix and exec_prefix if necessary
-  prefix_save=$prefix
-  exec_prefix_save=$exec_prefix
-
-  dnl if no prefix given, then use /usr/local, the default prefix
-  if test "x$prefix" = "xNONE"; then
-    prefix=$ac_default_prefix
-  fi
-  dnl if no exec_prefix given, then use prefix
-  if test "x$exec_prefix" = "xNONE"; then
-    exec_prefix=$prefix
-  fi
-
-  full_var="$FROM_VAR"
-  dnl loop until it doesn't change anymore
-  while true; do
-    new_full_var="`eval echo $full_var`"
-    if test "x$new_full_var"="x$full_var"; then break; fi
-    full_var=$new_full_var
-  done
-
-  dnl clean up
-  full_var=$new_full_var
-  AC_SUBST([$1], "$full_var")
-
-  dnl restore prefix and exec_prefix
-  prefix=$prefix_save
-  exec_prefix=$exec_prefix_save
-])
diff --git a/m4/ax_append_compile_flags.m4 b/m4/ax_append_compile_flags.m4
new file mode 100644 (file)
index 0000000..5b6f1af
--- /dev/null
@@ -0,0 +1,67 @@
+# ============================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+#   AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+#   For every FLAG1, FLAG2 it is checked whether the compiler works with the
+#   flag.  If it does, the flag is added FLAGS-VARIABLE
+#
+#   If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
+#   CFLAGS) is used.  During the check the flag is always added to the
+#   current language's flags.
+#
+#   If EXTRA-FLAGS is defined, it is added to the current language's default
+#   flags (e.g. CFLAGS) when the check is done.  The check is thus made with
+#   the flags: "CFLAGS EXTRA-FLAGS FLAG".  This can for example be used to
+#   force the compiler to issue an error when a bad flag is given.
+#
+#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+#   NOTE: This macro depends on the AX_APPEND_FLAG and
+#   AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
+#   AX_APPEND_LINK_FLAGS.
+#
+# LICENSE
+#
+#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program 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 General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 6
+
+AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
+[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
+AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+for flag in $1; do
+  AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
+done
+])dnl AX_APPEND_COMPILE_FLAGS
diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4
new file mode 100644 (file)
index 0000000..e8c5312
--- /dev/null
@@ -0,0 +1,71 @@
+# ===========================================================================
+#      https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
+#
+# DESCRIPTION
+#
+#   FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
+#   added in between.
+#
+#   If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
+#   CFLAGS) is used.  FLAGS-VARIABLE is not changed if it already contains
+#   FLAG.  If FLAGS-VARIABLE is unset in the shell, it is set to exactly
+#   FLAG.
+#
+#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program 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 General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 7
+
+AC_DEFUN([AX_APPEND_FLAG],
+[dnl
+AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
+AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
+AS_VAR_SET_IF(FLAGS,[
+  AS_CASE([" AS_VAR_GET(FLAGS) "],
+    [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
+    [
+     AS_VAR_APPEND(FLAGS,[" $1"])
+     AC_RUN_LOG([: FLAGS="$FLAGS"])
+    ])
+  ],
+  [
+  AS_VAR_SET(FLAGS,[$1])
+  AC_RUN_LOG([: FLAGS="$FLAGS"])
+  ])
+AS_VAR_POPDEF([FLAGS])dnl
+])dnl AX_APPEND_FLAG
diff --git a/m4/ax_append_link_flags.m4 b/m4/ax_append_link_flags.m4
new file mode 100644 (file)
index 0000000..6f7f174
--- /dev/null
@@ -0,0 +1,65 @@
+# ===========================================================================
+#   https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+#   For every FLAG1, FLAG2 it is checked whether the linker works with the
+#   flag.  If it does, the flag is added FLAGS-VARIABLE
+#
+#   If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
+#   used. During the check the flag is always added to the linker's flags.
+#
+#   If EXTRA-FLAGS is defined, it is added to the linker's default flags
+#   when the check is done.  The check is thus made with the flags: "LDFLAGS
+#   EXTRA-FLAGS FLAG".  This can for example be used to force the linker to
+#   issue an error when a bad flag is given.
+#
+#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+#   NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
+#   Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
+#
+# LICENSE
+#
+#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program 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 General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 6
+
+AC_DEFUN([AX_APPEND_LINK_FLAGS],
+[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
+AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+for flag in $1; do
+  AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
+done
+])dnl AX_APPEND_LINK_FLAGS
diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4
new file mode 100644 (file)
index 0000000..dcabb92
--- /dev/null
@@ -0,0 +1,74 @@
+# ===========================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+#   Check whether the given FLAG works with the current language's compiler
+#   or gives an error.  (Warnings, however, are ignored)
+#
+#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+#   success/failure.
+#
+#   If EXTRA-FLAGS is defined, it is added to the current language's default
+#   flags (e.g. CFLAGS) when the check is done.  The check is thus made with
+#   the flags: "CFLAGS EXTRA-FLAGS FLAG".  This can for example be used to
+#   force the compiler to issue an error when a bad flag is given.
+#
+#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+#   macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program 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 General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 5
+
+AC_DEFUN([AX_CHECK_COMPILE_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
+  ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
+  _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
+  AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+    [AS_VAR_SET(CACHEVAR,[yes])],
+    [AS_VAR_SET(CACHEVAR,[no])])
+  _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+  [m4_default([$2], :)],
+  [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_COMPILE_FLAGS
diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4
new file mode 100644 (file)
index 0000000..819409a
--- /dev/null
@@ -0,0 +1,74 @@
+# ===========================================================================
+#    https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+#   Check whether the given FLAG works with the linker or gives an error.
+#   (Warnings, however, are ignored)
+#
+#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+#   success/failure.
+#
+#   If EXTRA-FLAGS is defined, it is added to the linker's default flags
+#   when the check is done.  The check is thus made with the flags: "LDFLAGS
+#   EXTRA-FLAGS FLAG".  This can for example be used to force the linker to
+#   issue an error when a bad flag is given.
+#
+#   INPUT gives an alternative input source to AC_LINK_IFELSE.
+#
+#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+#   macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program 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 General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 5
+
+AC_DEFUN([AX_CHECK_LINK_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
+AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
+  ax_check_save_flags=$LDFLAGS
+  LDFLAGS="$LDFLAGS $4 $1"
+  AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+    [AS_VAR_SET(CACHEVAR,[yes])],
+    [AS_VAR_SET(CACHEVAR,[no])])
+  LDFLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+  [m4_default([$2], :)],
+  [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_LINK_FLAGS
diff --git a/m4/ax_code_coverage.m4 b/m4/ax_code_coverage.m4
new file mode 100644 (file)
index 0000000..0934a44
--- /dev/null
@@ -0,0 +1,264 @@
+# ===========================================================================
+#     https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CODE_COVERAGE()
+#
+# DESCRIPTION
+#
+#   Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
+#   CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included
+#   in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every
+#   build target (program or library) which should be built with code
+#   coverage support. Also defines CODE_COVERAGE_RULES which should be
+#   substituted in your Makefile; and $enable_code_coverage which can be
+#   used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
+#   and substituted, and corresponds to the value of the
+#   --enable-code-coverage option, which defaults to being disabled.
+#
+#   Test also for gcov program and create GCOV variable that could be
+#   substituted.
+#
+#   Note that all optimisation flags in CFLAGS must be disabled when code
+#   coverage is enabled.
+#
+#   Usage example:
+#
+#   configure.ac:
+#
+#     AX_CODE_COVERAGE
+#
+#   Makefile.am:
+#
+#     @CODE_COVERAGE_RULES@
+#     my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ...
+#     my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
+#     my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
+#     my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
+#
+#   This results in a "check-code-coverage" rule being added to any
+#   Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
+#   has been configured with --enable-code-coverage). Running `make
+#   check-code-coverage` in that directory will run the module's test suite
+#   (`make check`) and build a code coverage report detailing the code which
+#   was touched, then print the URI for the report.
+#
+#   In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined
+#   instead of CODE_COVERAGE_LIBS. They are both still defined, but use of
+#   CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is
+#   deprecated. They have the same value.
+#
+#   This code was derived from Makefile.decl in GLib, originally licenced
+#   under LGPLv2.1+.
+#
+# LICENSE
+#
+#   Copyright (c) 2012, 2016 Philip Withnall
+#   Copyright (c) 2012 Xan Lopez
+#   Copyright (c) 2012 Christian Persch
+#   Copyright (c) 2012 Paolo Borelli
+#   Copyright (c) 2012 Dan Winship
+#   Copyright (c) 2015 Bastien ROUCARIES
+#
+#   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 program. If not, see <https://www.gnu.org/licenses/>.
+
+#serial 21
+
+AC_DEFUN([AX_CODE_COVERAGE],[
+       dnl Check for --enable-code-coverage
+       AC_REQUIRE([AC_PROG_SED])
+
+       # allow to override gcov location
+       AC_ARG_WITH([gcov],
+         [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
+         [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
+         [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
+
+       AC_MSG_CHECKING([whether to build with code coverage support])
+       AC_ARG_ENABLE([code-coverage],
+         AS_HELP_STRING([--enable-code-coverage],
+         [Whether to enable code coverage support]),,
+         enable_code_coverage=no)
+
+       AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
+       AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
+       AC_MSG_RESULT($enable_code_coverage)
+
+       AS_IF([ test "$enable_code_coverage" = "yes" ], [
+               # check for gcov
+               AC_CHECK_TOOL([GCOV],
+                 [$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
+                 [:])
+               AS_IF([test "X$GCOV" = "X:"],
+                 [AC_MSG_ERROR([gcov is needed to do coverage])])
+               AC_SUBST([GCOV])
+
+               dnl Check if gcc is being used
+               AS_IF([ test "$GCC" = "no" ], [
+                       AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
+               ])
+
+               AC_CHECK_PROG([LCOV], [lcov], [lcov])
+               AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
+
+               AS_IF([ test -z "$LCOV" ], [
+                       AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed])
+               ])
+
+               AS_IF([ test -z "$GENHTML" ], [
+                       AC_MSG_ERROR([Could not find genhtml from the lcov package])
+               ])
+
+               dnl Build the code coverage flags
+               dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
+               CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
+               CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
+               CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
+               CODE_COVERAGE_LIBS="-lgcov"
+               CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
+
+               AC_SUBST([CODE_COVERAGE_CPPFLAGS])
+               AC_SUBST([CODE_COVERAGE_CFLAGS])
+               AC_SUBST([CODE_COVERAGE_CXXFLAGS])
+               AC_SUBST([CODE_COVERAGE_LIBS])
+               AC_SUBST([CODE_COVERAGE_LDFLAGS])
+
+               [CODE_COVERAGE_RULES_CHECK='
+       -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
+       $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
+']
+               [CODE_COVERAGE_RULES_CAPTURE='
+       $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
+       $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
+       -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
+       $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
+       @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
+']
+               [CODE_COVERAGE_RULES_CLEAN='
+clean: code-coverage-clean
+distclean: code-coverage-clean
+code-coverage-clean:
+       -$(LCOV) --directory $(top_builddir) -z
+       -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
+       -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
+']
+       ], [
+               [CODE_COVERAGE_RULES_CHECK='
+       @echo "Need to reconfigure with --enable-code-coverage"
+']
+               CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK"
+               CODE_COVERAGE_RULES_CLEAN=''
+       ])
+
+[CODE_COVERAGE_RULES='
+# Code coverage
+#
+# Optional:
+#  - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
+#    Multiple directories may be specified, separated by whitespace.
+#    (Default: $(top_builddir))
+#  - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
+#    by lcov for code coverage. (Default:
+#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
+#  - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
+#    reports to be created. (Default:
+#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
+#  - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
+#    set to 0 to disable it and leave empty to stay with the default.
+#    (Default: empty)
+#  - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
+#    instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
+#  - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
+#    instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
+#  - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
+#  - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
+#    collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
+#  - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
+#    instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
+#  - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
+#    lcov instance. (Default: empty)
+#  - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
+#    instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
+#  - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
+#    genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
+#  - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
+#    instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
+#  - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
+#
+# The generated report will be titled using the $(PACKAGE_NAME) and
+# $(PACKAGE_VERSION). In order to add the current git hash to the title,
+# use the git-version-gen script, available online.
+
+# Optional variables
+CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
+CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
+CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
+CODE_COVERAGE_BRANCH_COVERAGE ?=
+CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
+--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
+CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
+CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
+CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
+CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
+CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
+CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
+CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
+$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
+--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
+CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULTS)
+CODE_COVERAGE_IGNORE_PATTERN ?=
+
+code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
+code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
+code_coverage_v_lcov_cap_0 = @echo "  LCOV   --capture"\
+ $(CODE_COVERAGE_OUTPUT_FILE);
+code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
+code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
+code_coverage_v_lcov_ign_0 = @echo "  LCOV   --remove /tmp/*"\
+ $(CODE_COVERAGE_IGNORE_PATTERN);
+code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
+code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
+code_coverage_v_genhtml_0 = @echo "  GEN   " $(CODE_COVERAGE_OUTPUT_DIRECTORY);
+code_coverage_quiet = $(code_coverage_quiet_$(V))
+code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
+code_coverage_quiet_0 = --quiet
+
+# sanitizes the test-name: replaces with underscores: dashes and dots
+code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
+
+# Use recursive makes in order to ignore errors during check
+check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"'
+
+# Capture code coverage data
+code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"'
+
+# Hook rule executed before code-coverage-capture, overridable by the user
+code-coverage-capture-hook:
+
+'"$CODE_COVERAGE_RULES_CLEAN"'
+
+GITIGNOREFILES ?=
+GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
+
+A''M_DISTCHECK_CONFIGURE_FLAGS ?=
+A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
+
+.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
+']
+
+       AC_SUBST([CODE_COVERAGE_RULES])
+       m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
+])
diff --git a/m4/ax_compiler_flags.m4 b/m4/ax_compiler_flags.m4
new file mode 100644 (file)
index 0000000..ddb0456
--- /dev/null
@@ -0,0 +1,158 @@
+# ===========================================================================
+#    https://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_COMPILER_FLAGS([CFLAGS-VARIABLE], [LDFLAGS-VARIABLE], [IS-RELEASE], [EXTRA-BASE-CFLAGS], [EXTRA-YES-CFLAGS], [UNUSED], [UNUSED], [UNUSED], [EXTRA-BASE-LDFLAGS], [EXTRA-YES-LDFLAGS], [UNUSED], [UNUSED], [UNUSED])
+#
+# DESCRIPTION
+#
+#   Check for the presence of an --enable-compile-warnings option to
+#   configure, defaulting to "error" in normal operation, or "yes" if
+#   IS-RELEASE is equal to "yes".  Return the value in the variable
+#   $ax_enable_compile_warnings.
+#
+#   Depending on the value of --enable-compile-warnings, different compiler
+#   warnings are checked to see if they work with the current compiler and,
+#   if so, are appended to CFLAGS-VARIABLE and LDFLAGS-VARIABLE.  This
+#   allows a consistent set of baseline compiler warnings to be used across
+#   a code base, irrespective of any warnings enabled locally by individual
+#   developers.  By standardising the warnings used by all developers of a
+#   project, the project can commit to a zero-warnings policy, using -Werror
+#   to prevent compilation if new warnings are introduced.  This makes
+#   catching bugs which are flagged by warnings a lot easier.
+#
+#   By providing a consistent --enable-compile-warnings argument across all
+#   projects using this macro, continuous integration systems can easily be
+#   configured the same for all projects.  Automated systems or build
+#   systems aimed at beginners may want to pass the --disable-Werror
+#   argument to unconditionally prevent warnings being fatal.
+#
+#   --enable-compile-warnings can take the values:
+#
+#    * no:      Base compiler warnings only; not even -Wall.
+#    * yes:     The above, plus a broad range of useful warnings.
+#    * error:   The above, plus -Werror so that all warnings are fatal.
+#               Use --disable-Werror to override this and disable fatal
+#               warnings.
+#
+#   The set of base and enabled flags can be augmented using the
+#   EXTRA-*-CFLAGS and EXTRA-*-LDFLAGS variables, which are tested and
+#   appended to the output variable if --enable-compile-warnings is not
+#   "no". Flags should not be disabled using these arguments, as the entire
+#   point of AX_COMPILER_FLAGS is to enforce a consistent set of useful
+#   compiler warnings on code, using warnings which have been chosen for low
+#   false positive rates.  If a compiler emits false positives for a
+#   warning, a #pragma should be used in the code to disable the warning
+#   locally. See:
+#
+#     https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
+#
+#   The EXTRA-* variables should only be used to supply extra warning flags,
+#   and not general purpose compiler flags, as they are controlled by
+#   configure options such as --disable-Werror.
+#
+#   IS-RELEASE can be used to disable -Werror when making a release, which
+#   is useful for those hairy moments when you just want to get the release
+#   done as quickly as possible.  Set it to "yes" to disable -Werror. By
+#   default, it uses the value of $ax_is_release, so if you are using the
+#   AX_IS_RELEASE macro, there is no need to pass this parameter. For
+#   example:
+#
+#     AX_IS_RELEASE([git-directory])
+#     AX_COMPILER_FLAGS()
+#
+#   CFLAGS-VARIABLE defaults to WARN_CFLAGS, and LDFLAGS-VARIABLE defaults
+#   to WARN_LDFLAGS.  Both variables are AC_SUBST-ed by this macro, but must
+#   be manually added to the CFLAGS and LDFLAGS variables for each target in
+#   the code base.
+#
+#   If C++ language support is enabled with AC_PROG_CXX, which must occur
+#   before this macro in configure.ac, warning flags for the C++ compiler
+#   are AC_SUBST-ed as WARN_CXXFLAGS, and must be manually added to the
+#   CXXFLAGS variables for each target in the code base.  EXTRA-*-CFLAGS can
+#   be used to augment the base and enabled flags.
+#
+#   Warning flags for g-ir-scanner (from GObject Introspection) are
+#   AC_SUBST-ed as WARN_SCANNERFLAGS.  This variable must be manually added
+#   to the SCANNERFLAGS variable for each GIR target in the code base.  If
+#   extra g-ir-scanner flags need to be enabled, the AX_COMPILER_FLAGS_GIR
+#   macro must be invoked manually.
+#
+#   AX_COMPILER_FLAGS may add support for other tools in future, in addition
+#   to the compiler and linker.  No extra EXTRA-* variables will be added
+#   for those tools, and all extra support will still use the single
+#   --enable-compile-warnings configure option.  For finer grained control
+#   over the flags for individual tools, use AX_COMPILER_FLAGS_CFLAGS,
+#   AX_COMPILER_FLAGS_LDFLAGS and AX_COMPILER_FLAGS_* for new tools.
+#
+#   The UNUSED variables date from a previous version of this macro, and are
+#   automatically appended to the preceding non-UNUSED variable. They should
+#   be left empty in new uses of the macro.
+#
+# LICENSE
+#
+#   Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
+#   Copyright (c) 2015 David King <amigadave@amigadave.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 14
+
+# _AX_COMPILER_FLAGS_LANG([LANGNAME])
+m4_defun([_AX_COMPILER_FLAGS_LANG],
+[m4_ifdef([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [],
+          [m4_define([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [])dnl
+           AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_]$1[FLAGS])])dnl
+])
+
+AC_DEFUN([AX_COMPILER_FLAGS],[
+    # C support is enabled by default.
+    _AX_COMPILER_FLAGS_LANG([C])
+    # Only enable C++ support if AC_PROG_CXX is called. The redefinition of
+    # AC_PROG_CXX is so that a fatal error is emitted if this macro is called
+    # before AC_PROG_CXX, which would otherwise cause no C++ warnings to be
+    # checked.
+    AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                      [_AX_COMPILER_FLAGS_LANG([CXX])],
+                      [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AX_COMPILER_FLAGS_LANG([CXX])])])
+    AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_LDFLAGS])
+
+    # Default value for IS-RELEASE is $ax_is_release
+    ax_compiler_flags_is_release=m4_tolower(m4_normalize(ifelse([$3],,
+                                                                [$ax_is_release],
+                                                                [$3])))
+
+    AC_ARG_ENABLE([compile-warnings],
+                  AS_HELP_STRING([--enable-compile-warnings=@<:@no/yes/error@:>@],
+                                 [Enable compiler warnings and errors]),,
+                  [AS_IF([test "$ax_compiler_flags_is_release" = "yes"],
+                         [enable_compile_warnings="yes"],
+                         [enable_compile_warnings="error"])])
+    AC_ARG_ENABLE([Werror],
+                  AS_HELP_STRING([--disable-Werror],
+                                 [Unconditionally make all compiler warnings non-fatal]),,
+                  [enable_Werror=maybe])
+
+    # Return the user's chosen warning level
+    AS_IF([test "$enable_Werror" = "no" -a \
+                "$enable_compile_warnings" = "error"],[
+        enable_compile_warnings="yes"
+    ])
+
+    ax_enable_compile_warnings=$enable_compile_warnings
+
+    AX_COMPILER_FLAGS_CFLAGS([$1],[$ax_compiler_flags_is_release],
+                             [$4],[$5 $6 $7 $8])
+    m4_ifdef([_AX_COMPILER_FLAGS_LANG_CXX_enabled],
+             [AX_COMPILER_FLAGS_CXXFLAGS([WARN_CXXFLAGS],
+                                         [$ax_compiler_flags_is_release],
+                                         [$4],[$5 $6 $7 $8])])
+    AX_COMPILER_FLAGS_LDFLAGS([$2],[$ax_compiler_flags_is_release],
+                              [$9],[$10 $11 $12 $13])
+    AX_COMPILER_FLAGS_GIR([WARN_SCANNERFLAGS],[$ax_compiler_flags_is_release])
+])dnl AX_COMPILER_FLAGS
diff --git a/m4/ax_compiler_flags_cflags.m4 b/m4/ax_compiler_flags_cflags.m4
new file mode 100644 (file)
index 0000000..69162e1
--- /dev/null
@@ -0,0 +1,133 @@
+# =============================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html
+# =============================================================================
+#
+# SYNOPSIS
+#
+#   AX_COMPILER_FLAGS_CFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
+#
+# DESCRIPTION
+#
+#   Add warning flags for the C compiler to VARIABLE, which defaults to
+#   WARN_CFLAGS.  VARIABLE is AC_SUBST-ed by this macro, but must be
+#   manually added to the CFLAGS variable for each target in the code base.
+#
+#   This macro depends on the environment set up by AX_COMPILER_FLAGS.
+#   Specifically, it uses the value of $ax_enable_compile_warnings to decide
+#   which flags to enable.
+#
+# LICENSE
+#
+#   Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 13
+
+AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
+    AC_REQUIRE([AC_PROG_SED])
+    AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
+    AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+    AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
+
+    # Variable names
+    m4_define([ax_warn_cflags_variable],
+              [m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))])
+
+    AC_LANG_PUSH([C])
+
+    # Always pass -Werror=unknown-warning-option to get Clang to fail on bad
+    # flags, otherwise they are always appended to the warn_cflags variable, and
+    # Clang warns on them for every compilation unit.
+    # If this is passed to GCC, it will explode, so the flag must be enabled
+    # conditionally.
+    AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
+        ax_compiler_flags_test="-Werror=unknown-warning-option"
+    ],[
+        ax_compiler_flags_test=""
+    ])
+
+    # Base flags
+    AX_APPEND_COMPILE_FLAGS([ dnl
+        -fno-strict-aliasing dnl
+        $3 dnl
+    ],ax_warn_cflags_variable,[$ax_compiler_flags_test])
+
+    AS_IF([test "$ax_enable_compile_warnings" != "no"],[
+        # "yes" flags
+        AX_APPEND_COMPILE_FLAGS([ dnl
+            -Wall dnl
+            -Wextra dnl
+            -Wundef dnl
+            -Wnested-externs dnl
+            -Wwrite-strings dnl
+            -Wpointer-arith dnl
+            -Wmissing-declarations dnl
+            -Wmissing-prototypes dnl
+            -Wstrict-prototypes dnl
+            -Wredundant-decls dnl
+            -Wno-unused-parameter dnl
+            -Wno-missing-field-initializers dnl
+            -Wdeclaration-after-statement dnl
+            -Wformat=2 dnl
+            -Wold-style-definition dnl
+            -Wcast-align dnl
+            -Wformat-nonliteral dnl
+            -Wformat-security dnl
+            -Wsign-compare dnl
+            -Wstrict-aliasing dnl
+            -Wshadow dnl
+            -Winline dnl
+            -Wpacked dnl
+            -Wmissing-format-attribute dnl
+            -Wmissing-noreturn dnl
+            -Winit-self dnl
+            -Wredundant-decls dnl
+            -Wmissing-include-dirs dnl
+            -Wunused-but-set-variable dnl
+            -Warray-bounds dnl
+            -Wimplicit-function-declaration dnl
+            -Wreturn-type dnl
+            -Wswitch-enum dnl
+            -Wswitch-default dnl
+            $4 dnl
+            $5 dnl
+            $6 dnl
+            $7 dnl
+        ],ax_warn_cflags_variable,[$ax_compiler_flags_test])
+    ])
+    AS_IF([test "$ax_enable_compile_warnings" = "error"],[
+        # "error" flags; -Werror has to be appended unconditionally because
+        # it's not possible to test for
+        #
+        # suggest-attribute=format is disabled because it gives too many false
+        # positives
+        AX_APPEND_FLAG([-Werror],ax_warn_cflags_variable)
+
+        AX_APPEND_COMPILE_FLAGS([ dnl
+            -Wno-suggest-attribute=format dnl
+        ],ax_warn_cflags_variable,[$ax_compiler_flags_test])
+    ])
+
+    # In the flags below, when disabling specific flags, always add *both*
+    # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
+    # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall,
+    # which effectively turns that flag back on again as an error.
+    for flag in $ax_warn_cflags_variable; do
+        AS_CASE([$flag],
+                [-Wno-*=*],[],
+                [-Wno-*],[
+                    AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')],
+                                            ax_warn_cflags_variable,
+                                            [$ax_compiler_flags_test])
+                ])
+    done
+
+    AC_LANG_POP([C])
+
+    # Substitute the variables
+    AC_SUBST(ax_warn_cflags_variable)
+])dnl AX_COMPILER_FLAGS
diff --git a/m4/ax_compiler_flags_gir.m4 b/m4/ax_compiler_flags_gir.m4
new file mode 100644 (file)
index 0000000..5b4924a
--- /dev/null
@@ -0,0 +1,60 @@
+# ===========================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_gir.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_COMPILER_FLAGS_GIR([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
+#
+# DESCRIPTION
+#
+#   Add warning flags for the g-ir-scanner (from GObject Introspection) to
+#   VARIABLE, which defaults to WARN_SCANNERFLAGS.  VARIABLE is AC_SUBST-ed
+#   by this macro, but must be manually added to the SCANNERFLAGS variable
+#   for each GIR target in the code base.
+#
+#   This macro depends on the environment set up by AX_COMPILER_FLAGS.
+#   Specifically, it uses the value of $ax_enable_compile_warnings to decide
+#   which flags to enable.
+#
+# LICENSE
+#
+#   Copyright (c) 2015 Philip Withnall <philip@tecnocode.co.uk>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AC_DEFUN([AX_COMPILER_FLAGS_GIR],[
+    AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+
+    # Variable names
+    m4_define([ax_warn_scannerflags_variable],
+              [m4_normalize(ifelse([$1],,[WARN_SCANNERFLAGS],[$1]))])
+
+    # Base flags
+    AX_APPEND_FLAG([$3],ax_warn_scannerflags_variable)
+
+    AS_IF([test "$ax_enable_compile_warnings" != "no"],[
+        # "yes" flags
+        AX_APPEND_FLAG([ dnl
+            --warn-all dnl
+            $4 dnl
+            $5 dnl
+            $6 dnl
+            $7 dnl
+        ],ax_warn_scannerflags_variable)
+    ])
+    AS_IF([test "$ax_enable_compile_warnings" = "error"],[
+        # "error" flags
+        AX_APPEND_FLAG([ dnl
+            --warn-error dnl
+        ],ax_warn_scannerflags_variable)
+    ])
+
+    # Substitute the variables
+    AC_SUBST(ax_warn_scannerflags_variable)
+])dnl AX_COMPILER_FLAGS
diff --git a/m4/ax_compiler_flags_ldflags.m4 b/m4/ax_compiler_flags_ldflags.m4
new file mode 100644 (file)
index 0000000..842e329
--- /dev/null
@@ -0,0 +1,92 @@
+# ==============================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_ldflags.html
+# ==============================================================================
+#
+# SYNOPSIS
+#
+#   AX_COMPILER_FLAGS_LDFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
+#
+# DESCRIPTION
+#
+#   Add warning flags for the linker to VARIABLE, which defaults to
+#   WARN_LDFLAGS.  VARIABLE is AC_SUBST-ed by this macro, but must be
+#   manually added to the LDFLAGS variable for each target in the code base.
+#
+#   This macro depends on the environment set up by AX_COMPILER_FLAGS.
+#   Specifically, it uses the value of $ax_enable_compile_warnings to decide
+#   which flags to enable.
+#
+# LICENSE
+#
+#   Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 8
+
+AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[
+    AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS])
+    AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+    AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
+    AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
+
+    # Variable names
+    m4_define([ax_warn_ldflags_variable],
+              [m4_normalize(ifelse([$1],,[WARN_LDFLAGS],[$1]))])
+
+    # Always pass -Werror=unknown-warning-option to get Clang to fail on bad
+    # flags, otherwise they are always appended to the warn_ldflags variable,
+    # and Clang warns on them for every compilation unit.
+    # If this is passed to GCC, it will explode, so the flag must be enabled
+    # conditionally.
+    AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
+        ax_compiler_flags_test="-Werror=unknown-warning-option"
+    ],[
+        ax_compiler_flags_test=""
+    ])
+
+    # macOS linker does not have --as-needed
+    AX_CHECK_LINK_FLAG([-Wl,--no-as-needed], [
+        ax_compiler_flags_as_needed_option="-Wl,--no-as-needed"
+    ], [
+        ax_compiler_flags_as_needed_option=""
+    ])
+
+    # macOS linker speaks with a different accent
+    ax_compiler_flags_fatal_warnings_option=""
+    AX_CHECK_LINK_FLAG([-Wl,--fatal-warnings], [
+        ax_compiler_flags_fatal_warnings_option="-Wl,--fatal-warnings"
+    ])
+    AX_CHECK_LINK_FLAG([-Wl,-fatal_warnings], [
+        ax_compiler_flags_fatal_warnings_option="-Wl,-fatal_warnings"
+    ])
+
+    # Base flags
+    AX_APPEND_LINK_FLAGS([ dnl
+        $ax_compiler_flags_as_needed_option dnl
+        $3 dnl
+    ],ax_warn_ldflags_variable,[$ax_compiler_flags_test])
+
+    AS_IF([test "$ax_enable_compile_warnings" != "no"],[
+        # "yes" flags
+        AX_APPEND_LINK_FLAGS([$4 $5 $6 $7],
+                                ax_warn_ldflags_variable,
+                                [$ax_compiler_flags_test])
+    ])
+    AS_IF([test "$ax_enable_compile_warnings" = "error"],[
+        # "error" flags; -Werror has to be appended unconditionally because
+        # it's not possible to test for
+        #
+        # suggest-attribute=format is disabled because it gives too many false
+        # positives
+        AX_APPEND_LINK_FLAGS([ dnl
+            $ax_compiler_flags_fatal_warnings_option dnl
+        ],ax_warn_ldflags_variable,[$ax_compiler_flags_test])
+    ])
+
+    # Substitute the variables
+    AC_SUBST(ax_warn_ldflags_variable)
+])dnl AX_COMPILER_FLAGS
diff --git a/m4/ax_is_release.m4 b/m4/ax_is_release.m4
new file mode 100644 (file)
index 0000000..9097ddb
--- /dev/null
@@ -0,0 +1,80 @@
+# ===========================================================================
+#      https://www.gnu.org/software/autoconf-archive/ax_is_release.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_IS_RELEASE(POLICY)
+#
+# DESCRIPTION
+#
+#   Determine whether the code is being configured as a release, or from
+#   git. Set the ax_is_release variable to 'yes' or 'no'.
+#
+#   If building a release version, it is recommended that the configure
+#   script disable compiler errors and debug features, by conditionalising
+#   them on the ax_is_release variable.  If building from git, these
+#   features should be enabled.
+#
+#   The POLICY parameter specifies how ax_is_release is determined. It can
+#   take the following values:
+#
+#    * git-directory:  ax_is_release will be 'no' if a '.git' directory exists
+#    * minor-version:  ax_is_release will be 'no' if the minor version number
+#                      in $PACKAGE_VERSION is odd; this assumes
+#                      $PACKAGE_VERSION follows the 'major.minor.micro' scheme
+#    * micro-version:  ax_is_release will be 'no' if the micro version number
+#                      in $PACKAGE_VERSION is odd; this assumes
+#                      $PACKAGE_VERSION follows the 'major.minor.micro' scheme
+#    * dash-version:   ax_is_release will be 'no' if there is a dash '-'
+#                      in $PACKAGE_VERSION, for example 1.2-pre3, 1.2.42-a8b9
+#                      or 2.0-dirty (in particular this is suitable for use
+#                      with git-version-gen)
+#    * always:         ax_is_release will always be 'yes'
+#    * never:          ax_is_release will always be 'no'
+#
+#   Other policies may be added in future.
+#
+# LICENSE
+#
+#   Copyright (c) 2015 Philip Withnall <philip@tecnocode.co.uk>
+#   Copyright (c) 2016 Collabora Ltd.
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+#serial 7
+
+AC_DEFUN([AX_IS_RELEASE],[
+    AC_BEFORE([AC_INIT],[$0])
+
+    m4_case([$1],
+      [git-directory],[
+        # $is_release = (.git directory does not exist)
+        AS_IF([test -d ${srcdir}/.git],[ax_is_release=no],[ax_is_release=yes])
+      ],
+      [minor-version],[
+        # $is_release = ($minor_version is even)
+        minor_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
+        AS_IF([test "$(( $minor_version % 2 ))" -ne 0],
+              [ax_is_release=no],[ax_is_release=yes])
+      ],
+      [micro-version],[
+        # $is_release = ($micro_version is even)
+        micro_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]]*\.[[^.]]*\.\([[^.]]*\).*/\1/'`
+        AS_IF([test "$(( $micro_version % 2 ))" -ne 0],
+              [ax_is_release=no],[ax_is_release=yes])
+      ],
+      [dash-version],[
+        # $is_release = ($PACKAGE_VERSION has a dash)
+        AS_CASE([$PACKAGE_VERSION],
+                [*-*], [ax_is_release=no],
+                [*], [ax_is_release=yes])
+      ],
+      [always],[ax_is_release=yes],
+      [never],[ax_is_release=no],
+      [
+        AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version, micro-version, dash-version, always, never.])
+      ])
+])
diff --git a/m4/ax_require_defined.m4 b/m4/ax_require_defined.m4
new file mode 100644 (file)
index 0000000..17c3eab
--- /dev/null
@@ -0,0 +1,37 @@
+# ===========================================================================
+#    https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_REQUIRE_DEFINED(MACRO)
+#
+# DESCRIPTION
+#
+#   AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
+#   been defined and thus are available for use.  This avoids random issues
+#   where a macro isn't expanded.  Instead the configure script emits a
+#   non-fatal:
+#
+#     ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
+#
+#   It's like AC_REQUIRE except it doesn't expand the required macro.
+#
+#   Here's an example:
+#
+#     AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
+#
+# LICENSE
+#
+#   Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 2
+
+AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
+  m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
+])dnl AX_REQUIRE_DEFINED
diff --git a/m4/glib-2.0.m4 b/m4/glib-2.0.m4
new file mode 100644 (file)
index 0000000..d8f03d4
--- /dev/null
@@ -0,0 +1,211 @@
+# Configure paths for GLIB
+# Owen Taylor     1997-2001
+
+dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
+dnl gthread, or gio is specified in MODULES, pass to pkg-config
+dnl
+AC_DEFUN([AM_PATH_GLIB_2_0],
+[dnl 
+dnl Get the cflags and libraries from pkg-config
+dnl
+AC_ARG_ENABLE(glibtest, [  --disable-glibtest      do not try to compile and run a test GLIB program],
+                   , enable_glibtest=yes)
+
+  pkg_config_args=glib-2.0
+  for module in . $4
+  do
+      case "$module" in
+         gmodule) 
+             pkg_config_args="$pkg_config_args gmodule-2.0"
+         ;;
+         gmodule-no-export) 
+             pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
+         ;;
+         gobject) 
+             pkg_config_args="$pkg_config_args gobject-2.0"
+         ;;
+         gthread) 
+             pkg_config_args="$pkg_config_args gthread-2.0"
+         ;;
+         gio*) 
+             pkg_config_args="$pkg_config_args $module-2.0"
+         ;;
+      esac
+  done
+
+  PKG_PROG_PKG_CONFIG([0.16])
+
+  no_glib=""
+
+  if test "x$PKG_CONFIG" = x ; then
+    no_glib=yes
+    PKG_CONFIG=no
+  fi
+
+  min_glib_version=ifelse([$1], ,2.0.0,$1)
+  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
+
+  if test x$PKG_CONFIG != xno ; then
+    ## don't try to run the test against uninstalled libtool libs
+    if $PKG_CONFIG --uninstalled $pkg_config_args; then
+         echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
+         enable_glibtest=no
+    fi
+
+    if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
+         :
+    else
+         no_glib=yes
+    fi
+  fi
+
+  if test x"$no_glib" = x ; then
+    GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
+    GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
+    GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+    GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
+
+    GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
+    GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
+    glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_glibtest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GLIB_CFLAGS"
+      LIBS="$GLIB_LIBS $LIBS"
+dnl
+dnl Now check if the installed GLIB is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+      rm -f conf.glibtest
+      AC_TRY_RUN([
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int 
+main ()
+{
+  unsigned int major, minor, micro;
+
+  fclose (fopen ("conf.glibtest", "w"));
+
+  if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_glib_version");
+     exit(1);
+   }
+
+  if ((glib_major_version != $glib_config_major_version) ||
+      (glib_minor_version != $glib_config_minor_version) ||
+      (glib_micro_version != $glib_config_micro_version))
+    {
+      printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
+             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+             glib_major_version, glib_minor_version, glib_micro_version);
+      printf ("*** was found! If pkg-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+      printf("*** to point to the correct configuration files\n");
+    } 
+  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+          (glib_minor_version != GLIB_MINOR_VERSION) ||
+           (glib_micro_version != GLIB_MICRO_VERSION))
+    {
+      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+            GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+            glib_major_version, glib_minor_version, glib_micro_version);
+    }
+  else
+    {
+      if ((glib_major_version > major) ||
+        ((glib_major_version == major) && (glib_minor_version > minor)) ||
+        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n",
+               glib_major_version, glib_minor_version, glib_micro_version);
+        printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n",
+              major, minor, micro);
+        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
+        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_glib" = x ; then
+     AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$PKG_CONFIG" = "no" ; then
+       echo "*** A new enough version of pkg-config was not found."
+       echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+     else
+       if test -f conf.glibtest ; then
+        :
+       else
+          echo "*** Could not run GLIB test program, checking why..."
+          ac_save_CFLAGS="$CFLAGS"
+          ac_save_LIBS="$LIBS"
+          CFLAGS="$CFLAGS $GLIB_CFLAGS"
+          LIBS="$LIBS $GLIB_LIBS"
+          AC_TRY_LINK([
+#include <glib.h>
+#include <stdio.h>
+],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GLIB_CFLAGS=""
+     GLIB_LIBS=""
+     GLIB_GENMARSHAL=""
+     GOBJECT_QUERY=""
+     GLIB_MKENUMS=""
+     GLIB_COMPILE_RESOURCES=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GLIB_CFLAGS)
+  AC_SUBST(GLIB_LIBS)
+  AC_SUBST(GLIB_GENMARSHAL)
+  AC_SUBST(GOBJECT_QUERY)
+  AC_SUBST(GLIB_MKENUMS)
+  AC_SUBST(GLIB_COMPILE_RESOURCES)
+  rm -f conf.glibtest
+])
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644 (file)
index 0000000..d89c3d9
--- /dev/null
@@ -0,0 +1,96 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+    dnl enable/disable introspection
+    m4_if([$2], [require],
+    [dnl
+        enable_introspection=yes
+    ],[dnl
+        AC_ARG_ENABLE(introspection,
+                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+                                 [Enable introspection for this build]),, 
+                                 [enable_introspection=auto])
+    ])dnl
+
+    AC_MSG_CHECKING([for gobject-introspection])
+
+    dnl presence/version checking
+    AS_CASE([$enable_introspection],
+    [no], [dnl
+        found_introspection="no (disabled, use --enable-introspection to enable)"
+    ],dnl
+    [yes],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+                         found_introspection=yes,
+                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+    ],dnl
+    [auto],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+       dnl Canonicalize enable_introspection
+       enable_introspection=$found_introspection
+    ],dnl
+    [dnl       
+        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+    ])dnl
+
+    AC_MSG_RESULT([$found_introspection])
+
+    INTROSPECTION_SCANNER=
+    INTROSPECTION_COMPILER=
+    INTROSPECTION_GENERATE=
+    INTROSPECTION_GIRDIR=
+    INTROSPECTION_TYPELIBDIR=
+    if test "x$found_introspection" = "xyes"; then
+       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+    fi
+    AC_SUBST(INTROSPECTION_SCANNER)
+    AC_SUBST(INTROSPECTION_COMPILER)
+    AC_SUBST(INTROSPECTION_GENERATE)
+    AC_SUBST(INTROSPECTION_GIRDIR)
+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
+    AC_SUBST(INTROSPECTION_CFLAGS)
+    AC_SUBST(INTROSPECTION_LIBS)
+    AC_SUBST(INTROSPECTION_MAKEFILE)
+
+    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])
diff --git a/m4/jhflags.m4 b/m4/jhflags.m4
deleted file mode 100644 (file)
index 222e4b0..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-dnl
-dnl JH_ADD_CFLAG(FLAG)
-dnl checks whether the C compiler supports the given flag, and if so, adds
-dnl it to $CFLAGS.  If the flag is already present in the list, then the
-dnl check is not performed.
-AC_DEFUN([JH_ADD_CFLAG],
-[
-case " $CFLAGS " in
-*@<:@\ \ @:>@$1@<:@\   \ @:>@*)
-  ;;
-*)
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $1"
-  AC_MSG_CHECKING([whether [$]CC understands $1])
-  AC_TRY_COMPILE([], [], [jh_has_option=yes], [jh_has_option=no])
-  AC_MSG_RESULT($jh_has_option)
-  if test $jh_has_option = no; then
-    CFLAGS="$save_CFLAGS"
-  fi
-  ;;
-esac])
diff --git a/m4/pkg.m4 b/m4/pkg.m4
new file mode 100644 (file)
index 0000000..4688002
--- /dev/null
+++ b/m4/pkg.m4
@@ -0,0 +1,275 @@
+dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+dnl serial 11 (pkg-config-0.29)
+dnl
+dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
+
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
+
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=m4_default([$1], [0.9.0])
+       AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               PKG_CONFIG=""
+       fi
+fi[]dnl
+])dnl PKG_PROG_PKG_CONFIG
+
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_default([$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes ],
+                    [pkg_failed=yes])
+ else
+    pkg_failed=untried
+fi[]dnl
+])dnl _PKG_CONFIG
+
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
+
+
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+       AC_MSG_RESULT([no])
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+        else 
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+       m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+        ])
+elif test $pkg_failed = untried; then
+       AC_MSG_RESULT([no])
+       m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+        ])
+else
+       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+       $3
+fi[]dnl
+])dnl PKG_CHECK_MODULES
+
+
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
+
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+    [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_INSTALLDIR
+
+
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+    [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_NOARCH_INSTALLDIR
+
+
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])dnl PKG_CHECK_VAR
index cf9d5b1..1275d7f 100644 (file)
@@ -1,7 +1,7 @@
 ## this one is commonly used with AM_PATH_PYTHONDIR ...
-dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
+dnl PYG_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
 dnl Check if a module containing a given symbol is visible to python.
-AC_DEFUN([AM_CHECK_PYMOD],
+AC_DEFUN([PYG_CHECK_PYMOD],
 [AC_REQUIRE([AM_PATH_PYTHON])
 py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
 AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
@@ -37,9 +37,9 @@ fi
 ])
 
 dnl a macro to check for ability to create python extensions
-dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
+dnl  PYG_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
 dnl function also defines PYTHON_INCLUDES
-AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
+AC_DEFUN([PYG_CHECK_PYTHON_HEADERS],
 [AC_REQUIRE([AM_PATH_PYTHON])
 AC_MSG_CHECKING(for headers required to compile python extensions)
 dnl deduce PYTHON_INCLUDES
@@ -65,9 +65,9 @@ CPPFLAGS="$save_CPPFLAGS"
 ])
 
 dnl a macro to check for ability to embed python
-dnl  AM_CHECK_PYTHON_LIBS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
+dnl  PYG_CHECK_PYTHON_LIBS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
 dnl function also defines PYTHON_LIBS
-AC_DEFUN([AM_CHECK_PYTHON_LIBS],
+AC_DEFUN([PYG_CHECK_PYTHON_LIBS],
 [AC_REQUIRE([AM_PATH_PYTHON])
 AC_MSG_CHECKING(for libraries required to embed python)
 dnl deduce PYTHON_LIBS
index 1603a25..94a31e5 100644 (file)
@@ -89,10 +89,22 @@ build_triplet = @build@
 host_triplet = @host@
 subdir = pygtkcompat
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
-       $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
-       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+       $(top_srcdir)/m4/ax_append_flag.m4 \
+       $(top_srcdir)/m4/ax_append_link_flags.m4 \
+       $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+       $(top_srcdir)/m4/ax_check_link_flag.m4 \
+       $(top_srcdir)/m4/ax_code_coverage.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+       $(top_srcdir)/m4/ax_is_release.m4 \
+       $(top_srcdir)/m4/ax_require_defined.m4 \
+       $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
        $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
@@ -157,7 +169,6 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/py-compile
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -180,7 +191,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DLLTOOL = @DLLTOOL@
@@ -213,8 +223,14 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
 INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
 INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
 LCOV = @LCOV@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
@@ -247,14 +263,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
 PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
 PYCAIRO_LIBS = @PYCAIRO_LIBS@
 PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
 PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
 PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
 PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
 PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
 PYTHON_INCLUDES = @PYTHON_INCLUDES@
 PYTHON_LIBS = @PYTHON_LIBS@
@@ -262,15 +276,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
 PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
 VERSION = @VERSION@
 WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
index fd651f5..6884ef1 100644 (file)
@@ -84,7 +84,28 @@ def _install_enums(module, dest=None, strip=''):
             continue
 
 
+_enabled_registry = {}
+
+
+def _check_enabled(name, version=None):
+    """Returns True in case it is already enabled"""
+
+    if name in _enabled_registry:
+        enabled_version = _enabled_registry[name]
+        if enabled_version != version:
+            raise ValueError(
+                "%r already enabled with different version (%r)" % (
+                    name, enabled_version))
+        return True
+    else:
+        _enabled_registry[name] = version
+        return False
+
+
 def enable():
+    if _check_enabled(""):
+        return
+
     # gobject
     from gi.repository import GLib
     sys.modules['glib'] = GLib
@@ -104,6 +125,12 @@ _unset = object()
 
 
 def enable_gtk(version='3.0'):
+    if _check_enabled("gtk", version):
+        return
+
+    if version == "4.0":
+        raise ValueError("version 4.0 not supported")
+
     # set the default encoding like PyGTK
     reload(sys)
     if sys.version_info < (3, 0):
@@ -499,12 +526,18 @@ def enable_gtk(version='3.0'):
 
 
 def enable_vte():
+    if _check_enabled("vte"):
+        return
+
     gi.require_version('Vte', '0.0')
     from gi.repository import Vte
     sys.modules['vte'] = Vte
 
 
 def enable_poppler():
+    if _check_enabled("poppler"):
+        return
+
     gi.require_version('Poppler', '0.18')
     from gi.repository import Poppler
     sys.modules['poppler'] = Poppler
@@ -512,6 +545,9 @@ def enable_poppler():
 
 
 def enable_webkit(version='1.0'):
+    if _check_enabled("webkit", version):
+        return
+
     gi.require_version('WebKit', version)
     from gi.repository import WebKit
     sys.modules['webkit'] = WebKit
@@ -519,12 +555,18 @@ def enable_webkit(version='1.0'):
 
 
 def enable_gudev():
+    if _check_enabled("gudev"):
+        return
+
     gi.require_version('GUdev', '1.0')
     from gi.repository import GUdev
     sys.modules['gudev'] = GUdev
 
 
 def enable_gst():
+    if _check_enabled("gst"):
+        return
+
     gi.require_version('Gst', '0.10')
     from gi.repository import Gst
     sys.modules['gst'] = Gst
@@ -565,6 +607,9 @@ def enable_gst():
 
 
 def enable_goocanvas():
+    if _check_enabled("goocanvas"):
+        return
+
     gi.require_version('GooCanvas', '2.0')
     from gi.repository import GooCanvas
     sys.modules['goocanvas'] = GooCanvas
index 3c907f1..ff10433 100644 (file)
@@ -1,6 +1,27 @@
 CLEANFILES =
-check_LTLIBRARIES = libgimarshallingtests.la
+test_ltlibraries = libgimarshallingtests.la
 test_typelibs = GIMarshallingTests-1.0.typelib
+extension_ltlibraries =
+extension_libadd =
+
+common_ldflags = \
+       -avoid-version \
+       -rpath $(abs_builddir) \
+       -shared
+
+if OS_WIN32
+extension_libadd += \
+       $(PYTHON_LIBS)
+
+common_ldflags += \
+       -no-undefined
+endif
+
+# Note for Python extensions we need to use .so on Mac OSX, not .dylib
+extension_ldflags = \
+       $(common_ldflags) \
+       -module \
+       -shrext $(PYTHON_SO)
 
 nodist_libgimarshallingtests_la_SOURCES = \
        $(GI_DATADIR)/tests/gimarshallingtests.c \
@@ -10,15 +31,13 @@ dist_libgimarshallingtests_la_SOURCES = \
        $(srcdir)/gimarshallingtestsextra.c \
        $(srcdir)/gimarshallingtestsextra.h
 
+# We don't control the source so don't pass WARN_CFLAGS etc
 libgimarshallingtests_la_CFLAGS = $(GLIB_CFLAGS)
-libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) -no-undefined
-
-# This is a hack to make sure a shared library is built
-libgimarshallingtests.la: $(libgimarshallingtests_la_OBJECTS) $(libgimarshallingtests_la_DEPENDENCIES)
-       $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libgimarshallingtests_la_LDFLAGS) $(libgimarshallingtests_la_OBJECTS) $(libgimarhallingtests_la_LIBADD) $(LIBS)
+libgimarshallingtests_la_LDFLAGS = $(common_ldflags)
+libgimarshallingtests_la_LIBADD = $(GLIB_LIBS)
 
 GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile
-       $(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \
+       $(AM_V_GEN) $(INTROSPECTION_SCANNER) --include=Gio-2.0 \
        --namespace=GIMarshallingTests --nsversion=1.0 --symbol-prefix=gi_marshalling_tests \
        --warn-all --warn-error \
        --library=libgimarshallingtests.la \
@@ -28,22 +47,25 @@ GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile
        $(dist_libgimarshallingtests_la_SOURCES)
 
 GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir Makefile
-       $(AM_V_GEN) g-ir-compiler $< -o $@
+       $(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
 
 # regress.c needs cairo
-if ENABLE_CAIRO
-check_LTLIBRARIES += libregress.la
+test_ltlibraries += libregress.la
 test_typelibs += Regress-1.0.typelib
 nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
+# We don't control the source so don't pass WARN_CFLAGS etc
+if ENABLE_CAIRO
 libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
-libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS) -no-undefined
-
-libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES)
-       $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libregress_la_LDFLAGS) $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS)
+libregress_la_LIBADD = $(GIO_LIBS) $(CAIRO_LIBS)
+else
+libregress_la_CFLAGS = $(GIO_CFLAGS) -D_GI_DISABLE_CAIRO
+libregress_la_LIBADD = $(GIO_LIBS) $(CAIRO_LIBS)
+endif
+libregress_la_LDFLAGS = $(common_ldflags)
 
 # g-i doesn't ship these as shared libraries anymore; we build them here
 Regress-1.0.gir: libregress.la Makefile
-       $(AM_V_GEN) g-ir-scanner --include=cairo-1.0 --include=Gio-2.0 \
+       $(AM_V_GEN) $(INTROSPECTION_SCANNER) --include=cairo-1.0 --include=Gio-2.0 \
        --namespace=Regress --nsversion=1.0 \
        --warn-all --warn-error \
        --library=libregress.la \
@@ -51,43 +73,39 @@ Regress-1.0.gir: libregress.la Makefile
        --output $@ \
        $(nodist_libregress_la_SOURCES)
 Regress-1.0.typelib: Regress-1.0.gir Makefile
-       $(AM_V_GEN) g-ir-compiler $< -o $@
-
-endif # ENABLE_CAIRO
-
+       $(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
 
 gschemas.compiled: org.gnome.test.gschema.xml
        glib-compile-schemas --targetdir=. --schema-file=$<
 
 CLEANFILES += Regress-1.0.gir Regress-1.0.typelib GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib gschemas.compiled
 
-check_LTLIBRARIES += testhelper.la
+extension_ltlibraries += testhelper.la
+
+testhelper_la_CFLAGS = $(CODE_COVERAGE_CFLAGS) $(WARN_CFLAGS) -I$(top_srcdir)/gi $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
+testhelper_la_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
+testhelper_la_LDFLAGS = $(WARN_LDFLAGS) $(extension_ldflags)
+testhelper_la_LIBADD = $(CODE_COVERAGE_LIBS) $(GLIB_LIBS) $(extension_libadd)
 
-testhelper_la_CFLAGS = -I$(top_srcdir)/gi $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
-testhelper_la_LDFLAGS = -module -avoid-version -no-undefined $(PYTHON_LIBS)
-testhelper_la_LIBADD = $(GLIB_LIBS)
 testhelper_la_SOURCES = \
        testhelpermodule.c \
        test-floating.c \
        test-thread.c \
        test-unknown.c
 
-# This is a hack to make sure a shared library is built
-testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
-       $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
+check_LTLIBRARIES = $(test_ltlibraries) $(extension_ltlibraries)
 
+target_libraries = \
+       $(test_ltlibraries:.la=.$(OS_EXT)) \
+       $(extension_ltlibraries:.la=$(PYTHON_SO))
 
-.la.$(OS_EXT):
+$(target_libraries):
        test -L $@ || $(LN_S) .libs/$@ $@
 
-
-all: $(check_LTLIBRARIES:.la=.$(OS_EXT))
-
 EXTRA_DIST = \
        helper.py \
        compathelper.py \
        runtests.py \
-       runtests-windows.py \
        testmodule.py \
        test-floating.h \
        test-thread.h \
@@ -133,23 +151,25 @@ EXTRA_DIST = \
        $(NULL)
 
 clean-local:
-       rm -f $(check_LTLIBRARIES:.la=.$(OS_EXT)) file.txt~
+       rm -f $(target_libraries) file.txt~
 
+# Unsetting MSYSTEM prevents msys2 from changing os.path.sep to "/"
 RUN_TESTS_ENV_VARS= \
-       PYTHONPATH=$(top_builddir):$(top_builddir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \
-       LD_LIBRARY_PATH=$(builddir)/.libs:$$LD_LIBRARY_PATH \
-       GI_TYPELIB_PATH=$(builddir):$$GI_TYPELIB_PATH \
-       XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share \
        MALLOC_PERTURB_=85 \
        MALLOC_CHECK_=3 \
        G_SLICE=debug-blocks \
+       MSYSTEM= \
        TESTS_BUILDDIR=$(builddir)
 
+# if dbus-run-session is available, use it, otherwise disable DBUS
+check-local:
+       DBUS_ENV=$$(dbus-run-session true && echo "dbus-run-session --" || echo "DBUS_SESSION_BUS_ADDRESS=.") $(MAKE) check.real
+
 # pygtkcompat tests need to be run in a separate process as they
 # clobber global name space
-check-local: $(check_LTLIBRARIES:.la=.$(OS_EXT)) $(test_typelibs) gschemas.compiled
-       $(RUN_TESTS_ENV_VARS) dbus-run-session -- $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
-       [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) dbus-run-session -- $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \
+check.real: $(target_libraries) $(test_typelibs) gschemas.compiled
+       $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
+       [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS)  $(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \
        exit $$rc
 
 check.gdb:
@@ -160,17 +180,17 @@ check.nemiver:
 
 # Note G_SLICE in these check variations is intended to clobber the default set in RUN_TESTS_ENV_VARS
 check.valgrind:
-       EXEC_NAME="G_SLICE=always-malloc G_DEBUG=gc-friendly \
-       valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
-       --suppressions=$(top_srcdir)/tests/$(PYTHON_BASENAME).supp \
+       EXTRA_ENV="G_SLICE=always-malloc G_DEBUG=gc-friendly PYTHONMALLOC=malloc" \
+       EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
+       --suppressions=$(top_srcdir)/tests/$(PYTHON_VALGRIND_SUPP).supp \
        " \
        $(MAKE) check
 
 check.valgrindlog:
        mkdir -p $(top_builddir)/tmp
-       EXEC_NAME="G_SLICE=always-malloc G_DEBUG=gc-friendly \
-       valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
-       --suppressions=$(top_srcdir)/tests/$(PYTHON_BASENAME).supp \
+       EXTRA_ENV="G_SLICE=always-malloc G_DEBUG=gc-friendly PYTHONMALLOC=malloc" \
+       EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
+       --suppressions=$(top_srcdir)/tests/$(PYTHON_VALGRIND_SUPP).supp \
        --child-silent-after-fork=yes \
        --log-file=$(top_builddir)/tmp/`git rev-parse HEAD | cut -c1-8`-$$TEST_NAMES.log \
        " \
@@ -178,9 +198,9 @@ check.valgrindlog:
 
 check.valgrindxml:
        mkdir -p $(top_builddir)/tmp
-       EXEC_NAME="G_SLICE=always-malloc G_DEBUG=gc-friendly \
-       valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
-       --suppressions=$(top_srcdir)/tests/$(PYTHON_BASENAME).supp \
+       EXTRA_ENV="G_SLICE=always-malloc G_DEBUG=gc-friendly PYTHONMALLOC=malloc" \
+       EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
+       --suppressions=$(top_srcdir)/tests/$(PYTHON_VALGRIND_SUPP).supp \
        --child-silent-after-fork=yes \
        --xml=yes --xml-file=$(top_builddir)/tmp/`git rev-parse HEAD | cut -c1-8`-$$TEST_NAMES.xml \
        " \
index 70bfe67..3e34139 100644 (file)
@@ -87,16 +87,30 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
+@OS_WIN32_TRUE@am__append_1 = \
+@OS_WIN32_TRUE@        $(PYTHON_LIBS)
+
+@OS_WIN32_TRUE@am__append_2 = \
+@OS_WIN32_TRUE@        -no-undefined
 
-# regress.c needs cairo
-@ENABLE_CAIRO_TRUE@am__append_1 = libregress.la
-@ENABLE_CAIRO_TRUE@am__append_2 = Regress-1.0.typelib
 subdir = tests
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
-       $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \
-       $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-       $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \
+       $(top_srcdir)/m4/ax_append_flag.m4 \
+       $(top_srcdir)/m4/ax_append_link_flags.m4 \
+       $(top_srcdir)/m4/ax_check_compile_flag.m4 \
+       $(top_srcdir)/m4/ax_check_link_flag.m4 \
+       $(top_srcdir)/m4/ax_code_coverage.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_gir.m4 \
+       $(top_srcdir)/m4/ax_compiler_flags_ldflags.m4 \
+       $(top_srcdir)/m4/ax_is_release.m4 \
+       $(top_srcdir)/m4/ax_require_defined.m4 \
+       $(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/introspection.m4 \
+       $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+       $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+       $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
        $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
@@ -105,7 +119,8 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-libgimarshallingtests_la_LIBADD =
+am__DEPENDENCIES_1 =
+libgimarshallingtests_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
 dist_libgimarshallingtests_la_OBJECTS =  \
        libgimarshallingtests_la-gimarshallingtestsextra.lo
 nodist_libgimarshallingtests_la_OBJECTS =  \
@@ -121,16 +136,20 @@ libgimarshallingtests_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
        $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
        $(libgimarshallingtests_la_CFLAGS) $(CFLAGS) \
        $(libgimarshallingtests_la_LDFLAGS) $(LDFLAGS) -o $@
-libregress_la_LIBADD =
-@ENABLE_CAIRO_TRUE@nodist_libregress_la_OBJECTS =  \
-@ENABLE_CAIRO_TRUE@    libregress_la-regress.lo
+@ENABLE_CAIRO_FALSE@libregress_la_DEPENDENCIES =  \
+@ENABLE_CAIRO_FALSE@   $(am__DEPENDENCIES_1) \
+@ENABLE_CAIRO_FALSE@   $(am__DEPENDENCIES_1)
+@ENABLE_CAIRO_TRUE@libregress_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+@ENABLE_CAIRO_TRUE@    $(am__DEPENDENCIES_1)
+nodist_libregress_la_OBJECTS = libregress_la-regress.lo
 libregress_la_OBJECTS = $(nodist_libregress_la_OBJECTS)
 libregress_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libregress_la_CFLAGS) \
        $(CFLAGS) $(libregress_la_LDFLAGS) $(LDFLAGS) -o $@
-@ENABLE_CAIRO_TRUE@am_libregress_la_rpath =
-am__DEPENDENCIES_1 =
-testhelper_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+@OS_WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
+testhelper_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_3)
 am_testhelper_la_OBJECTS = testhelper_la-testhelpermodule.lo \
        testhelper_la-test-floating.lo testhelper_la-test-thread.lo \
        testhelper_la-test-unknown.lo
@@ -204,7 +223,6 @@ CTAGS = ctags
 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
-ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -227,7 +245,6 @@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
-DATADIR = @DATADIR@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DLLTOOL = @DLLTOOL@
@@ -260,8 +277,14 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
 INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
 INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
 LCOV = @LCOV@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
@@ -294,14 +317,12 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
 PKG_CONFIG = @PKG_CONFIG@
 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PLATFORM = @PLATFORM@
 PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@
 PYCAIRO_LIBS = @PYCAIRO_LIBS@
 PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@
 PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@
 PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@
 PYTHON = @PYTHON@
-PYTHON_BASENAME = @PYTHON_BASENAME@
 PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
 PYTHON_INCLUDES = @PYTHON_INCLUDES@
 PYTHON_LIBS = @PYTHON_LIBS@
@@ -309,15 +330,17 @@ PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
 PYTHON_SO = @PYTHON_SO@
+PYTHON_VALGRIND_SUPP = @PYTHON_VALGRIND_SUPP@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-THREADING_CFLAGS = @THREADING_CFLAGS@
 VERSION = @VERSION@
 WARN_CFLAGS = @WARN_CFLAGS@
+WARN_LDFLAGS = @WARN_LDFLAGS@
+WARN_SCANNERFLAGS = @WARN_SCANNERFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -378,9 +401,21 @@ top_srcdir = @top_srcdir@
 CLEANFILES = Regress-1.0.gir Regress-1.0.typelib \
        GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib \
        gschemas.compiled
-check_LTLIBRARIES = libgimarshallingtests.la $(am__append_1) \
-       testhelper.la
-test_typelibs = GIMarshallingTests-1.0.typelib $(am__append_2)
+
+# regress.c needs cairo
+test_ltlibraries = libgimarshallingtests.la libregress.la
+test_typelibs = GIMarshallingTests-1.0.typelib Regress-1.0.typelib
+extension_ltlibraries = testhelper.la
+extension_libadd = $(am__append_1)
+common_ldflags = -avoid-version -rpath $(abs_builddir) -shared \
+       $(am__append_2)
+
+# Note for Python extensions we need to use .so on Mac OSX, not .dylib
+extension_ldflags = \
+       $(common_ldflags) \
+       -module \
+       -shrext $(PYTHON_SO)
+
 nodist_libgimarshallingtests_la_SOURCES = \
        $(GI_DATADIR)/tests/gimarshallingtests.c \
        $(GI_DATADIR)/tests/gimarshallingtests.h
@@ -389,25 +424,37 @@ dist_libgimarshallingtests_la_SOURCES = \
        $(srcdir)/gimarshallingtestsextra.c \
        $(srcdir)/gimarshallingtestsextra.h
 
+
+# We don't control the source so don't pass WARN_CFLAGS etc
 libgimarshallingtests_la_CFLAGS = $(GLIB_CFLAGS)
-libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) -no-undefined
-@ENABLE_CAIRO_TRUE@nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
+libgimarshallingtests_la_LDFLAGS = $(common_ldflags)
+libgimarshallingtests_la_LIBADD = $(GLIB_LIBS)
+nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
+@ENABLE_CAIRO_FALSE@libregress_la_CFLAGS = $(GIO_CFLAGS) -D_GI_DISABLE_CAIRO
+# We don't control the source so don't pass WARN_CFLAGS etc
 @ENABLE_CAIRO_TRUE@libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
-@ENABLE_CAIRO_TRUE@libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS) -no-undefined
-testhelper_la_CFLAGS = -I$(top_srcdir)/gi $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
-testhelper_la_LDFLAGS = -module -avoid-version -no-undefined $(PYTHON_LIBS)
-testhelper_la_LIBADD = $(GLIB_LIBS)
+@ENABLE_CAIRO_FALSE@libregress_la_LIBADD = $(GIO_LIBS) $(CAIRO_LIBS)
+@ENABLE_CAIRO_TRUE@libregress_la_LIBADD = $(GIO_LIBS) $(CAIRO_LIBS)
+libregress_la_LDFLAGS = $(common_ldflags)
+testhelper_la_CFLAGS = $(CODE_COVERAGE_CFLAGS) $(WARN_CFLAGS) -I$(top_srcdir)/gi $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
+testhelper_la_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
+testhelper_la_LDFLAGS = $(WARN_LDFLAGS) $(extension_ldflags)
+testhelper_la_LIBADD = $(CODE_COVERAGE_LIBS) $(GLIB_LIBS) $(extension_libadd)
 testhelper_la_SOURCES = \
        testhelpermodule.c \
        test-floating.c \
        test-thread.c \
        test-unknown.c
 
+check_LTLIBRARIES = $(test_ltlibraries) $(extension_ltlibraries)
+target_libraries = \
+       $(test_ltlibraries:.la=.$(OS_EXT)) \
+       $(extension_ltlibraries:.la=$(PYTHON_SO))
+
 EXTRA_DIST = \
        helper.py \
        compathelper.py \
        runtests.py \
-       runtests-windows.py \
        testmodule.py \
        test-floating.h \
        test-thread.h \
@@ -452,20 +499,19 @@ EXTRA_DIST = \
        gi/overrides/Regress.py \
        $(NULL)
 
+
+# Unsetting MSYSTEM prevents msys2 from changing os.path.sep to "/"
 RUN_TESTS_ENV_VARS = \
-       PYTHONPATH=$(top_builddir):$(top_builddir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \
-       LD_LIBRARY_PATH=$(builddir)/.libs:$$LD_LIBRARY_PATH \
-       GI_TYPELIB_PATH=$(builddir):$$GI_TYPELIB_PATH \
-       XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share \
        MALLOC_PERTURB_=85 \
        MALLOC_CHECK_=3 \
        G_SLICE=debug-blocks \
+       MSYSTEM= \
        TESTS_BUILDDIR=$(builddir)
 
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .$(OS_EXT) .c .la .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -507,8 +553,14 @@ clean-checkLTLIBRARIES:
          rm -f $${locs}; \
        }
 
-@ENABLE_CAIRO_FALSE@libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES) $(EXTRA_libregress_la_DEPENDENCIES) 
-@ENABLE_CAIRO_FALSE@   $(AM_V_CCLD)$(libregress_la_LINK) $(am_libregress_la_rpath) $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS)
+libgimarshallingtests.la: $(libgimarshallingtests_la_OBJECTS) $(libgimarshallingtests_la_DEPENDENCIES) $(EXTRA_libgimarshallingtests_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(libgimarshallingtests_la_LINK)  $(libgimarshallingtests_la_OBJECTS) $(libgimarshallingtests_la_LIBADD) $(LIBS)
+
+libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES) $(EXTRA_libregress_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(libregress_la_LINK)  $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS)
+
+testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES) $(EXTRA_testhelper_la_DEPENDENCIES) 
+       $(AM_V_CCLD)$(testhelper_la_LINK)  $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
@@ -567,32 +619,32 @@ libregress_la-regress.lo: $(GI_DATADIR)/tests/regress.c
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libregress_la_CFLAGS) $(CFLAGS) -c -o libregress_la-regress.lo `test -f '$(GI_DATADIR)/tests/regress.c' || echo '$(srcdir)/'`$(GI_DATADIR)/tests/regress.c
 
 testhelper_la-testhelpermodule.lo: testhelpermodule.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-testhelpermodule.lo -MD -MP -MF $(DEPDIR)/testhelper_la-testhelpermodule.Tpo -c -o testhelper_la-testhelpermodule.lo `test -f 'testhelpermodule.c' || echo '$(srcdir)/'`testhelpermodule.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testhelper_la_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-testhelpermodule.lo -MD -MP -MF $(DEPDIR)/testhelper_la-testhelpermodule.Tpo -c -o testhelper_la-testhelpermodule.lo `test -f 'testhelpermodule.c' || echo '$(srcdir)/'`testhelpermodule.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/testhelper_la-testhelpermodule.Tpo $(DEPDIR)/testhelper_la-testhelpermodule.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='testhelpermodule.c' object='testhelper_la-testhelpermodule.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-testhelpermodule.lo `test -f 'testhelpermodule.c' || echo '$(srcdir)/'`testhelpermodule.c
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testhelper_la_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-testhelpermodule.lo `test -f 'testhelpermodule.c' || echo '$(srcdir)/'`testhelpermodule.c
 
 testhelper_la-test-floating.lo: test-floating.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-test-floating.lo -MD -MP -MF $(DEPDIR)/testhelper_la-test-floating.Tpo -c -o testhelper_la-test-floating.lo `test -f 'test-floating.c' || echo '$(srcdir)/'`test-floating.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testhelper_la_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-test-floating.lo -MD -MP -MF $(DEPDIR)/testhelper_la-test-floating.Tpo -c -o testhelper_la-test-floating.lo `test -f 'test-floating.c' || echo '$(srcdir)/'`test-floating.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/testhelper_la-test-floating.Tpo $(DEPDIR)/testhelper_la-test-floating.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='test-floating.c' object='testhelper_la-test-floating.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-test-floating.lo `test -f 'test-floating.c' || echo '$(srcdir)/'`test-floating.c
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testhelper_la_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-test-floating.lo `test -f 'test-floating.c' || echo '$(srcdir)/'`test-floating.c
 
 testhelper_la-test-thread.lo: test-thread.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-test-thread.lo -MD -MP -MF $(DEPDIR)/testhelper_la-test-thread.Tpo -c -o testhelper_la-test-thread.lo `test -f 'test-thread.c' || echo '$(srcdir)/'`test-thread.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testhelper_la_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-test-thread.lo -MD -MP -MF $(DEPDIR)/testhelper_la-test-thread.Tpo -c -o testhelper_la-test-thread.lo `test -f 'test-thread.c' || echo '$(srcdir)/'`test-thread.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/testhelper_la-test-thread.Tpo $(DEPDIR)/testhelper_la-test-thread.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='test-thread.c' object='testhelper_la-test-thread.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-test-thread.lo `test -f 'test-thread.c' || echo '$(srcdir)/'`test-thread.c
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testhelper_la_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-test-thread.lo `test -f 'test-thread.c' || echo '$(srcdir)/'`test-thread.c
 
 testhelper_la-test-unknown.lo: test-unknown.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-test-unknown.lo -MD -MP -MF $(DEPDIR)/testhelper_la-test-unknown.Tpo -c -o testhelper_la-test-unknown.lo `test -f 'test-unknown.c' || echo '$(srcdir)/'`test-unknown.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testhelper_la_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-test-unknown.lo -MD -MP -MF $(DEPDIR)/testhelper_la-test-unknown.Tpo -c -o testhelper_la-test-unknown.lo `test -f 'test-unknown.c' || echo '$(srcdir)/'`test-unknown.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/testhelper_la-test-unknown.Tpo $(DEPDIR)/testhelper_la-test-unknown.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='test-unknown.c' object='testhelper_la-test-unknown.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-test-unknown.lo `test -f 'test-unknown.c' || echo '$(srcdir)/'`test-unknown.c
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testhelper_la_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-test-unknown.lo `test -f 'test-unknown.c' || echo '$(srcdir)/'`test-unknown.c
 
 mostlyclean-libtool:
        -rm -f *.lo
@@ -809,12 +861,8 @@ uninstall-am:
 .PRECIOUS: Makefile
 
 
-# This is a hack to make sure a shared library is built
-libgimarshallingtests.la: $(libgimarshallingtests_la_OBJECTS) $(libgimarshallingtests_la_DEPENDENCIES)
-       $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libgimarshallingtests_la_LDFLAGS) $(libgimarshallingtests_la_OBJECTS) $(libgimarhallingtests_la_LIBADD) $(LIBS)
-
 GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile
-       $(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \
+       $(AM_V_GEN) $(INTROSPECTION_SCANNER) --include=Gio-2.0 \
        --namespace=GIMarshallingTests --nsversion=1.0 --symbol-prefix=gi_marshalling_tests \
        --warn-all --warn-error \
        --library=libgimarshallingtests.la \
@@ -824,43 +872,38 @@ GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile
        $(dist_libgimarshallingtests_la_SOURCES)
 
 GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir Makefile
-       $(AM_V_GEN) g-ir-compiler $< -o $@
-
-@ENABLE_CAIRO_TRUE@libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES)
-@ENABLE_CAIRO_TRUE@    $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libregress_la_LDFLAGS) $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS)
+       $(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
 
 # g-i doesn't ship these as shared libraries anymore; we build them here
-@ENABLE_CAIRO_TRUE@Regress-1.0.gir: libregress.la Makefile
-@ENABLE_CAIRO_TRUE@    $(AM_V_GEN) g-ir-scanner --include=cairo-1.0 --include=Gio-2.0 \
-@ENABLE_CAIRO_TRUE@    --namespace=Regress --nsversion=1.0 \
-@ENABLE_CAIRO_TRUE@    --warn-all --warn-error \
-@ENABLE_CAIRO_TRUE@    --library=libregress.la \
-@ENABLE_CAIRO_TRUE@    --libtool="$(top_builddir)/libtool" \
-@ENABLE_CAIRO_TRUE@    --output $@ \
-@ENABLE_CAIRO_TRUE@    $(nodist_libregress_la_SOURCES)
-@ENABLE_CAIRO_TRUE@Regress-1.0.typelib: Regress-1.0.gir Makefile
-@ENABLE_CAIRO_TRUE@    $(AM_V_GEN) g-ir-compiler $< -o $@
+Regress-1.0.gir: libregress.la Makefile
+       $(AM_V_GEN) $(INTROSPECTION_SCANNER) --include=cairo-1.0 --include=Gio-2.0 \
+       --namespace=Regress --nsversion=1.0 \
+       --warn-all --warn-error \
+       --library=libregress.la \
+       --libtool="$(top_builddir)/libtool" \
+       --output $@ \
+       $(nodist_libregress_la_SOURCES)
+Regress-1.0.typelib: Regress-1.0.gir Makefile
+       $(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
 
 gschemas.compiled: org.gnome.test.gschema.xml
        glib-compile-schemas --targetdir=. --schema-file=$<
 
-# This is a hack to make sure a shared library is built
-testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
-       $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
-
-.la.$(OS_EXT):
+$(target_libraries):
        test -L $@ || $(LN_S) .libs/$@ $@
 
-all: $(check_LTLIBRARIES:.la=.$(OS_EXT))
-
 clean-local:
-       rm -f $(check_LTLIBRARIES:.la=.$(OS_EXT)) file.txt~
+       rm -f $(target_libraries) file.txt~
+
+# if dbus-run-session is available, use it, otherwise disable DBUS
+check-local:
+       DBUS_ENV=$$(dbus-run-session true && echo "dbus-run-session --" || echo "DBUS_SESSION_BUS_ADDRESS=.") $(MAKE) check.real
 
 # pygtkcompat tests need to be run in a separate process as they
 # clobber global name space
-check-local: $(check_LTLIBRARIES:.la=.$(OS_EXT)) $(test_typelibs) gschemas.compiled
-       $(RUN_TESTS_ENV_VARS) dbus-run-session -- $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
-       [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) dbus-run-session -- $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \
+check.real: $(target_libraries) $(test_typelibs) gschemas.compiled
+       $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
+       [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS)  $(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \
        exit $$rc
 
 check.gdb:
@@ -871,17 +914,17 @@ check.nemiver:
 
 # Note G_SLICE in these check variations is intended to clobber the default set in RUN_TESTS_ENV_VARS
 check.valgrind:
-       EXEC_NAME="G_SLICE=always-malloc G_DEBUG=gc-friendly \
-       valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
-       --suppressions=$(top_srcdir)/tests/$(PYTHON_BASENAME).supp \
+       EXTRA_ENV="G_SLICE=always-malloc G_DEBUG=gc-friendly PYTHONMALLOC=malloc" \
+       EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
+       --suppressions=$(top_srcdir)/tests/$(PYTHON_VALGRIND_SUPP).supp \
        " \
        $(MAKE) check
 
 check.valgrindlog:
        mkdir -p $(top_builddir)/tmp
-       EXEC_NAME="G_SLICE=always-malloc G_DEBUG=gc-friendly \
-       valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
-       --suppressions=$(top_srcdir)/tests/$(PYTHON_BASENAME).supp \
+       EXTRA_ENV="G_SLICE=always-malloc G_DEBUG=gc-friendly PYTHONMALLOC=malloc" \
+       EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
+       --suppressions=$(top_srcdir)/tests/$(PYTHON_VALGRIND_SUPP).supp \
        --child-silent-after-fork=yes \
        --log-file=$(top_builddir)/tmp/`git rev-parse HEAD | cut -c1-8`-$$TEST_NAMES.log \
        " \
@@ -889,9 +932,9 @@ check.valgrindlog:
 
 check.valgrindxml:
        mkdir -p $(top_builddir)/tmp
-       EXEC_NAME="G_SLICE=always-malloc G_DEBUG=gc-friendly \
-       valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
-       --suppressions=$(top_srcdir)/tests/$(PYTHON_BASENAME).supp \
+       EXTRA_ENV="G_SLICE=always-malloc G_DEBUG=gc-friendly PYTHONMALLOC=malloc" \
+       EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
+       --suppressions=$(top_srcdir)/tests/$(PYTHON_VALGRIND_SUPP).supp \
        --child-silent-after-fork=yes \
        --xml=yes --xml-file=$(top_builddir)/tmp/`git rev-parse HEAD | cut -c1-8`-$$TEST_NAMES.xml \
        " \
index 71b1c06..6552256 100644 (file)
@@ -4,13 +4,7 @@
 import unittest
 import base64
 
-import gi
-
 try:
-    try:
-        gi.require_version("Gtk", "3.0")
-    except ValueError as e:
-        raise ImportError(e)
     from gi.repository import Gtk
     from gi.repository import Pango
     from gi.repository import Atk
@@ -20,20 +14,41 @@ try:
     import pygtkcompat
 
     pygtkcompat.enable()
-    pygtkcompat.enable_gtk(version='3.0')
+    pygtkcompat.enable_gtk(version=Gtk._version)
 
     import atk
     import pango
     import pangocairo
     import gtk
     import gtk.gdk
-except ImportError:
+except (ValueError, ImportError):
     Gtk = None
 
 from helper import capture_gi_deprecation_warnings, capture_glib_warnings
 
 
 @unittest.skipUnless(Gtk, 'Gtk not available')
+class TestMultipleEnable(unittest.TestCase):
+
+    def test_main(self):
+        pygtkcompat.enable()
+        pygtkcompat.enable()
+
+    def test_gtk(self):
+        pygtkcompat.enable_gtk("3.0")
+        pygtkcompat.enable_gtk("3.0")
+
+        # https://bugzilla.gnome.org/show_bug.cgi?id=759009
+        w = gtk.Window()
+        w.realize()
+        self.assertEqual(len(w.window.get_origin()), 2)
+        w.destroy()
+
+    def test_gtk_version_conflict(self):
+        self.assertRaises(ValueError, pygtkcompat.enable_gtk, version='2.0')
+
+
+@unittest.skipUnless(Gtk, 'Gtk not available')
 class TestATKCompat(unittest.TestCase):
     def test_object(self):
         self.assertTrue(hasattr(atk, 'Object'))
@@ -161,4 +176,6 @@ class TestGTKCompat(unittest.TestCase):
     def test_gdk_window(self):
         w = gtk.Window()
         w.realize()
-        self.assertEqual(w.get_window().get_origin(), (0, 0))
+        origin = w.get_window().get_origin()
+        self.assertTrue(isinstance(origin, tuple))
+        self.assertEqual(len(origin), 2)
index e5de550..d4f4d27 100644 (file)
@@ -1,5 +1,6 @@
 import sys
-import collections
+
+PY2 = PY3 = False
 
 if sys.version_info >= (3, 0):
     '''
@@ -29,49 +30,12 @@ if sys.version_info >= (3, 0):
     '''
     _basestring = str
 
-    '''
-    for tests that need to write to intefaces that take bytes in
-    python 3
-
-    python 3 has a seperate bytes type for low level functions like os.write
-
-    python 2 treats these as strings
-
-    any tests that need to write a string of bytes should do something like
-    this:
-
-    from compathelper import _bytes
-    os.write(_bytes("hello"))
-    '''
-
-    _bytes = lambda s: s.encode()
-
-    '''
-    for tests that need to write to intefaces that take unicode in
-    python 2
-
-    python 3 strings are unicode encoded as UTF-8 so the unicode object
-    doesn't exist
-
-    python 2 differs between a string an unicode string and you must specify
-    an encoding.  This macro will specify UTF-8 in python 2
-
-    any tests that need to use unicode should do this
-
-    from compathelper import _unicode
-    unicode_string = _unicode('this is a unicode string')
-    '''
-
-    _unicode = lambda s: str(s)
-
-    callable = lambda x: isinstance(x, collections.Callable)
     from io import StringIO
     StringIO
+    PY3 = True
 else:
     _long = long
     _basestring = basestring
-    _bytes = str
-    _unicode = lambda s: unicode(s, 'UTF-8')
-    callable = callable
     from StringIO import StringIO
     StringIO
+    PY2 = True
index 85a9fba..eee3a14 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include "gimarshallingtestsextra.h"
+#include <string.h>
 
 void
 gi_marshalling_tests_compare_two_gerrors_in_gvalue (GValue *v, GValue *v1)
@@ -82,6 +83,19 @@ gi_marshalling_tests_filename_copy (gchar *path_in)
 }
 
 /**
+ * gi_marshalling_tests_filename_to_glib_repr:
+ * @path_in: (type filename) (nullable)
+ *
+ * Returns: (array length=len) (element-type guint8)
+ */
+gchar *
+gi_marshalling_tests_filename_to_glib_repr (gchar *path_in, gsize *len)
+{
+  *len = strlen(path_in);
+  return g_strdup (path_in);
+}
+
+/**
  * gi_marshalling_tests_filename_exists:
  * @path: (type filename)
  */
index 51a65f2..5452688 100644 (file)
@@ -35,5 +35,6 @@ GHashTable * gi_marshalling_tests_ghashtable_enum_none_return (void);
 
 gchar * gi_marshalling_tests_filename_copy (gchar *path_in);
 gboolean gi_marshalling_tests_filename_exists (gchar *path);
+gchar * gi_marshalling_tests_filename_to_glib_repr (gchar *path_in, gsize *len);
 
 #endif /* EXTRA_TESTS */
index c4308fe..0d2f204 100644 (file)
@@ -10,7 +10,7 @@ import gi
 from gi import PyGIDeprecationWarning
 from gi.repository import GLib
 
-from compathelper import callable, StringIO
+from compathelper import StringIO
 
 
 ExceptionInfo = namedtuple("ExceptionInfo", ["type", "value", "traceback"])
@@ -88,7 +88,7 @@ def capture_glib_warnings(allow_warnings=False, allow_criticals=False):
 
     GLib.log_set_always_fatal(GLib.LogLevelFlags(new_mask))
 
-    GLibWarning = gi._gi._gobject.Warning
+    GLibWarning = gi._gi.Warning
     try:
         with warnings.catch_warnings(record=True) as warn:
             warnings.filterwarnings('always', category=GLibWarning)
@@ -101,12 +101,12 @@ def capture_glib_warnings(allow_warnings=False, allow_criticals=False):
 def capture_glib_deprecation_warnings():
     """Temporarily suppress glib deprecation warning output and record them"""
 
-    GLibWarning = gi._gi._gobject.Warning
+    GLibWarning = gi._gi.Warning
     with warnings.catch_warnings(record=True) as warn:
         warnings.filterwarnings(
             'always', category=GLibWarning,
-            message=".+ is deprecated and shouldn't be used anymore\. "
-                    "It will be removed in a future version\.")
+            message=".+ is deprecated and shouldn't be used anymore\\. "
+                    "It will be removed in a future version\\.")
         yield warn
 
 
diff --git a/tests/runtests-windows.py b/tests/runtests-windows.py
deleted file mode 100644 (file)
index f9524f4..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-
-import os
-import sys
-import glob
-import unittest
-
-mydir = os.path.dirname(os.path.abspath(__file__))
-tests_builddir = os.path.abspath(os.environ.get('TESTS_BUILDDIR', os.path.dirname(__file__)))
-builddir = os.path.dirname(tests_builddir)
-
-# we have to do this here instead of Makefile.am so that the implicitly added
-# directory for the source file comes after the builddir
-sys.path.insert(0, tests_builddir)
-sys.path.insert(0, builddir)
-
-os.environ['PYGTK_USE_GIL_STATE_API'] = ''
-sys.argv.append('--g-fatal-warnings')
-
-from gi.repository import GObject
-GObject.threads_init()
-
-
-SKIP_FILES = ['runtests',
-              'test_mainloop',      # no os.fork on windows
-              'test_subprocess']    # blocks on testChildWatch
-
-
-if __name__ == '__main__':
-    testdir = os.path.split(os.path.abspath(__file__))[0]
-    os.chdir(testdir)
-
-    def gettestnames():
-        files = glob.glob('*.py')
-        names = map(lambda x: x[:-3], files)
-        map(names.remove, SKIP_FILES)
-        return names
-
-    suite = unittest.TestSuite()
-    loader = unittest.TestLoader()
-
-    for name in gettestnames():
-        try:
-            suite.addTest(loader.loadTestsFromName(name))
-        except Exception as e:
-            print('Could not load %s: %s' % (name, e))
-
-    testRunner = unittest.TextTestRunner()
-    testRunner.verbosity = 2
-    testRunner.run(suite)
index 6085ff9..fda4dd1 100755 (executable)
@@ -11,6 +11,11 @@ import unittest
 if sys.version_info[:2] == (2, 7):
     unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
 
+if sys.version_info[0] == 3:
+    unittest.TestCase.assertRegexpMatches = unittest.TestCase.assertRegex
+    unittest.TestCase.assertRaisesRegexp = unittest.TestCase.assertRaisesRegex
+
+
 if '--help' in sys.argv:
     print("Usage: ./runtests.py <testfiles>")
     sys.exit(0)
@@ -18,15 +23,20 @@ if '--help' in sys.argv:
 mydir = os.path.dirname(os.path.abspath(__file__))
 tests_builddir = os.path.abspath(os.environ.get('TESTS_BUILDDIR', os.path.dirname(__file__)))
 builddir = os.path.dirname(tests_builddir)
+tests_srcdir = os.path.abspath(os.path.dirname(__file__))
+srcdir = os.path.dirname(tests_srcdir)
 
-# we have to do this here instead of Makefile.am so that the implicitly added
-# directory for the source file comes after the builddir
+sys.path.insert(0, tests_srcdir)
+sys.path.insert(0, srcdir)
 sys.path.insert(0, tests_builddir)
 sys.path.insert(0, builddir)
 
 # force untranslated messages, as we check for them in some tests
 os.environ['LC_MESSAGES'] = 'C'
 os.environ['G_DEBUG'] = 'fatal-warnings fatal-criticals'
+if sys.platform == "darwin":
+    # gtk 3.22 has warnings and ciriticals on OS X, ignore for now
+    os.environ['G_DEBUG'] = ''
 
 # make Gio able to find our gschemas.compiled in tests/. This needs to be set
 # before importing Gio. Support a separate build tree, so look in build dir
@@ -35,6 +45,39 @@ os.environ['GSETTINGS_BACKEND'] = 'memory'
 os.environ['GSETTINGS_SCHEMA_DIR'] = tests_builddir
 os.environ['G_FILENAME_ENCODING'] = 'UTF-8'
 
+import gi
+gi.require_version("GIRepository", "2.0")
+from gi.repository import GIRepository
+repo = GIRepository.Repository.get_default()
+repo.prepend_library_path(os.path.join(tests_builddir, ".libs"))
+repo.prepend_search_path(tests_builddir)
+
+
+def try_require_version(namespace, version):
+    try:
+        gi.require_version(namespace, version)
+    except ValueError:
+        # prevent tests from running with the wrong version
+        sys.modules["gi.repository." + namespace] = None
+
+
+# Optional
+try_require_version("Gtk", os.environ.get("TEST_GTK_VERSION", "3.0"))
+try_require_version("Gdk", os.environ.get("TEST_GTK_VERSION", "3.0"))
+try_require_version("GdkPixbuf", "2.0")
+try_require_version("Pango", "1.0")
+try_require_version("PangoCairo", "1.0")
+try_require_version("Atk", "1.0")
+
+# Required
+gi.require_versions({
+    "GIMarshallingTests": "1.0",
+    "Regress": "1.0",
+    "GLib": "2.0",
+    "Gio": "2.0",
+    "GObject": "2.0",
+})
+
 # Load tests.
 if 'TEST_NAMES' in os.environ:
     names = os.environ['TEST_NAMES'].split()
index dfd4e36..a2c2d5b 100644 (file)
@@ -1,12 +1,15 @@
+import os
+import sys
 import unittest
 
 try:
-    import gi
-    gi.require_version('Gtk', '3.0')
     from gi.repository import Gtk, Atk, Gdk
-    (Atk, Gdk)  # pyflakes
-except (ValueError, ImportError):
+except ImportError:
     Gdk = None
+    Atk = None
+    Gtk = None
+
+from helper import capture_glib_deprecation_warnings
 
 
 @unittest.skipUnless(Gdk, 'Gdk not available')
@@ -53,6 +56,7 @@ class TestGdkAtom(unittest.TestCase):
         self.assertTrue(Gtk.targets_include_image([a_jpeg], False))
         self.assertTrue(Gtk.targets_include_image([a_jpeg, a_plain], False))
 
+    @unittest.skipIf(sys.platform == "darwin", "fails on OSX")
     def test_out_array(self):
         a_selection = Gdk.Atom.intern('my_clipboard', False)
         clipboard = Gtk.Clipboard.get(a_selection)
@@ -72,10 +76,14 @@ class TestGdkAtom(unittest.TestCase):
         self.assertFalse(None in names, names)
         self.assertTrue('TEXT' in names, names)
 
+    @unittest.skipIf(sys.platform == "darwin" or os.name == "nt",
+                     "fails on OSX/Windows")
+    @unittest.skipIf(not Gdk or Gdk._version == "4.0", "not in gdk4")
     def test_out_glist(self):
         display = Gdk.Display.get_default()
-        dm = display.get_device_manager()
-        device = dm.get_client_pointer()
+        with capture_glib_deprecation_warnings():
+            dm = display.get_device_manager()
+            device = dm.get_client_pointer()
         axes = device.list_axes()
         axes_names = [atom.name() for atom in axes]
         self.assertNotEqual(axes_names, [])
index fdf86a2..3edf5d5 100644 (file)
@@ -9,18 +9,20 @@ import gi
 try:
     gi.require_foreign('cairo')
     import cairo
-    from gi.repository import Regress
     has_cairo = True
 except ImportError:
     has_cairo = False
 
+has_region = has_cairo and hasattr(cairo, "Region")
+
 try:
-    from gi.repository import Gtk
-    Gtk  # pyflakes
+    from gi.repository import Gtk, Gdk
+    Gtk, Gdk  # pyflakes
 except:
     Gtk = None
+    Gdk = None
 
-from gi.repository import GObject
+from gi.repository import GObject, Regress
 
 
 @unittest.skipUnless(has_cairo, 'built without cairo support')
@@ -67,6 +69,27 @@ class Test(unittest.TestCase):
 
 
 @unittest.skipUnless(has_cairo, 'built without cairo support')
+@unittest.skipUnless(has_region, 'built without cairo.Region support')
+@unittest.skipUnless(Gdk, 'Gdk not available')
+class TestRegion(unittest.TestCase):
+
+    def test_region_to_py(self):
+        surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10)
+        context = cairo.Context(surface)
+        context.paint()
+        region = Gdk.cairo_region_create_from_surface(surface)
+        r = region.get_extents()
+        self.assertEqual((r.height, r.width), (10, 10))
+
+    def test_region_from_py(self):
+        surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10)
+        context = cairo.Context(surface)
+        region = cairo.Region(cairo.RectangleInt(0, 0, 42, 42))
+        Gdk.cairo_region(context, region)
+        self.assertTrue("42" in repr(list(context.copy_path())))
+
+
+@unittest.skipUnless(has_cairo, 'built without cairo support')
 @unittest.skipUnless(Gtk, 'Gtk not available')
 class TestPango(unittest.TestCase):
     def test_cairo_font_options(self):
index d520b04..29b7e5e 100644 (file)
@@ -2,19 +2,16 @@ import unittest
 
 import gi.docstring
 
+from gi.repository import Regress
 from gi.repository import GIMarshallingTests
 from gi.repository import Gio
 from gi.repository import GObject
 from gi.repository import GLib
 
 try:
-    import cairo
-    cairo = cairo
-    has_cairo = True
-    from gi.repository import Regress
     from gi.repository import Gtk
 except ImportError:
-    has_cairo = False
+    Gtk = None
 
 
 class Test(unittest.TestCase):
@@ -80,7 +77,6 @@ class Test(unittest.TestCase):
         self.assertTrue('new()' in doc)
         self.assertTrue('BoxedStruct()' in doc)
 
-    @unittest.skipUnless(has_cairo, 'built without cairo support')
     def test_private_struct_constructors(self):
         # Structs without a size or constructor should have no constructor docs.
         doc = Regress.TestBoxedPrivate.__doc__
@@ -94,7 +90,7 @@ class Test(unittest.TestCase):
         self.assertEqual(GIMarshallingTests.array_out_etc.__doc__,
                          'array_out_etc(first:int, last:int) -> ints:list, sum:int')
 
-    @unittest.skipUnless(has_cairo, 'built without cairo support')
+    @unittest.skipUnless(Gtk, 'no Gtk')
     def test_shared_array_length_with_prior_out_arg(self):
         # Test the 'iter' out argument does not effect length argument skipping.
         self.assertEqual(Gtk.ListStore.insert_with_valuesv.__doc__,
index 0b5cf6d..0378781 100644 (file)
@@ -8,14 +8,7 @@ import ctypes
 import warnings
 import sys
 
-try:
-    import cairo
-    cairo  # Pyflakes
-    has_cairo = True
-    from gi.repository import Regress as Everything
-except ImportError:
-    has_cairo = False
-
+from gi.repository import Regress as Everything
 from gi.repository import GObject
 from gi.repository import GLib
 from gi.repository import Gio
@@ -53,7 +46,14 @@ class RawGList(ctypes.Structure):
         return ctypes.POINTER(cls).from_address(id(obj) + offset)
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
+class TestInstanceTransfer(unittest.TestCase):
+
+    def test_main(self):
+        obj = Everything.TestObj()
+        for _ in range(10):
+            obj.instance_method_full()
+
+
 class TestEverything(unittest.TestCase):
 
     def test_bool(self):
@@ -566,10 +566,9 @@ class TestEverything(unittest.TestCase):
             self.assertTrue('TestBoxedPrivate' in str(e_value), str(e_value))
             self.assertTrue('constructor' in str(e_value), str(e_value))
             tb = ''.join(traceback.format_exception(e_type, e_value, e_tb))
-            self.assertTrue('tests/test_everything.py", line' in tb, tb)
+            self.assertTrue('test_everything.py", line' in tb, tb)
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestNullableArgs(unittest.TestCase):
     def test_in_nullable_hash(self):
         Everything.test_ghash_null_in(None)
@@ -607,7 +606,6 @@ class TestNullableArgs(unittest.TestCase):
         self.assertEqual(None, Everything.TestObj.null_out())
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestCallbacks(unittest.TestCase):
     called = False
     main_loop = GLib.MainLoop()
@@ -1016,7 +1014,6 @@ class TestCallbacks(unittest.TestCase):
         self.assertEqual(mydict, {'foo': 1, 'bar': 2, 'new': 42})
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestClosures(unittest.TestCase):
     def test_no_arg(self):
         def callback():
@@ -1077,7 +1074,6 @@ class TestClosures(unittest.TestCase):
         self.assertTrue('return value' in str(exc[0].value), exc[0].value)
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestBoxed(unittest.TestCase):
     def test_boxed(self):
         object_ = Everything.TestObj()
@@ -1128,7 +1124,6 @@ class TestBoxed(unittest.TestCase):
         self.assertNotEqual(id(boxed), id(copy))
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestTortureProfile(unittest.TestCase):
     def test_torture_profile(self):
         import time
@@ -1191,7 +1186,6 @@ class TestTortureProfile(unittest.TestCase):
         print("\tTotal: %f sec" % total_time)
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestAdvancedInterfaces(unittest.TestCase):
     def test_array_objs(self):
         obj1, obj2 = Everything.test_array_fixed_out_objects()
index def3511..ac09949 100644 (file)
@@ -8,8 +8,6 @@ from gi.repository import GLib
 from gi.repository import Regress
 from gi.repository import GIMarshallingTests
 
-from compathelper import _unicode
-
 
 class Number(object):
 
@@ -108,8 +106,8 @@ class TestFields(unittest.TestCase):
         s.string_ = "hello"
         self.assertEqual(s.string_, "hello")
 
-        s.string_ = _unicode("hello")
-        self.assertEqual(s.string_, _unicode("hello"))
+        s.string_ = u"hello"
+        self.assertEqual(s.string_, u"hello")
 
         s.string_ = None
         self.assertEqual(s.string_, None)
index 805633a..5fb4f5d 100644 (file)
@@ -7,6 +7,15 @@ from gi.repository import GLib
 from gi.repository import Gio
 
 
+try:
+    Gio.bus_get_sync(Gio.BusType.SESSION, None)
+except GLib.Error:
+    has_dbus = False
+else:
+    has_dbus = True
+
+
+@unittest.skipUnless(has_dbus, "no dbus running")
 class TestGDBusClient(unittest.TestCase):
     def setUp(self):
         self.bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
index d0c72b6..173744a 100644 (file)
@@ -23,18 +23,11 @@ from gi.repository import GObject, GLib, Gio
 
 from gi.repository import GIMarshallingTests
 
-from compathelper import _bytes, _unicode
+from compathelper import PY2, PY3
 from helper import capture_exceptions
 
-if sys.version_info < (3, 0):
-    CONSTANT_UTF8 = "const \xe2\x99\xa5 utf8"
-    PY2_UNICODE_UTF8 = unicode(CONSTANT_UTF8, 'UTF-8')
-    CHAR_255 = '\xff'
-else:
-    CONSTANT_UTF8 = "const ♥ utf8"
-    CHAR_255 = bytes([255])
 
-CONSTANT_NUMBER = 42
+CONSTANT_UTF8 = "const ♥ utf8"
 
 
 class Number(object):
@@ -67,7 +60,7 @@ class TestConstant(unittest.TestCase):
         self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8)
 
     def test_constant_number(self):
-        self.assertEqual(CONSTANT_NUMBER, GIMarshallingTests.CONSTANT_NUMBER)
+        self.assertEqual(42, GIMarshallingTests.CONSTANT_NUMBER)
 
     def test_min_max_int(self):
         self.assertEqual(GLib.MAXINT32, 2 ** 31 - 1)
@@ -145,7 +138,7 @@ class TestUInt8(unittest.TestCase):
         number = Number(self.MAX)
 
         GIMarshallingTests.uint8_in(number)
-        GIMarshallingTests.uint8_in(CHAR_255)
+        GIMarshallingTests.uint8_in(b'\xff')
 
         number.value += 1
         self.assertRaises(OverflowError, GIMarshallingTests.uint8_in, number)
@@ -427,7 +420,7 @@ class TestInt(unittest.TestCase):
     def test_int_inout(self):
         self.assertEqual(self.MIN, GIMarshallingTests.int_inout_max_min(Number(self.MAX)))
         self.assertEqual(self.MAX, GIMarshallingTests.int_inout_min_max(Number(self.MIN)))
-        self.assertRaises(TypeError, GIMarshallingTests.int_inout_min_max, Number(self.MIN), CONSTANT_NUMBER)
+        self.assertRaises(TypeError, GIMarshallingTests.int_inout_min_max, Number(self.MIN), 42)
 
 
 class TestUInt(unittest.TestCase):
@@ -517,8 +510,8 @@ class TestULong(unittest.TestCase):
 
 class TestSSize(unittest.TestCase):
 
-    MAX = GLib.MAXLONG
-    MIN = GLib.MINLONG
+    MAX = GLib.MAXSSIZE
+    MIN = GLib.MINSSIZE
 
     def test_ssize_return(self):
         self.assertEqual(self.MAX, GIMarshallingTests.ssize_return_max())
@@ -550,7 +543,7 @@ class TestSSize(unittest.TestCase):
 
 class TestSize(unittest.TestCase):
 
-    MAX = GLib.MAXULONG
+    MAX = GLib.MAXSIZE
 
     def test_size_return(self):
         self.assertEqual(self.MAX, GIMarshallingTests.size_return())
@@ -671,9 +664,9 @@ class TestUtf8(unittest.TestCase):
     def test_utf8_none_in(self):
         GIMarshallingTests.utf8_none_in(CONSTANT_UTF8)
         if sys.version_info < (3, 0):
-            GIMarshallingTests.utf8_none_in(PY2_UNICODE_UTF8)
+            GIMarshallingTests.utf8_none_in(CONSTANT_UTF8.decode("utf-8"))
 
-        self.assertRaises(TypeError, GIMarshallingTests.utf8_none_in, CONSTANT_NUMBER)
+        self.assertRaises(TypeError, GIMarshallingTests.utf8_none_in, 42)
         self.assertRaises(TypeError, GIMarshallingTests.utf8_none_in, None)
 
     def test_utf8_none_out(self):
@@ -700,7 +693,7 @@ class TestFilename(unittest.TestCase):
         shutil.rmtree(self.workdir)
 
     def test_filename_in(self):
-        fname = os.path.join(self.workdir, _unicode('testäø.txt'))
+        fname = os.path.join(self.workdir, u'testäø.txt')
         self.assertRaises(GLib.GError, GLib.file_get_contents, fname)
 
         with open(fname.encode('UTF-8'), 'wb') as f:
@@ -714,17 +707,161 @@ class TestFilename(unittest.TestCase):
         self.assertTrue(GIMarshallingTests.filename_copy(None) is None)
         self.assertRaises(TypeError, GIMarshallingTests.filename_exists, None)
 
+    @unittest.skipIf(os.name == "nt", "fixme")
     def test_filename_out(self):
         self.assertRaises(GLib.GError, GLib.Dir.make_tmp, 'test')
 
         dirname = GLib.Dir.make_tmp('testäø.XXXXXX')
-        self.assertTrue('/testäø.' in dirname, dirname)
-        dirname = _bytes(dirname)
+        self.assertTrue(os.path.sep + 'testäø.' in dirname, dirname)
         self.assertTrue(os.path.isdir(dirname))
         os.rmdir(dirname)
 
-    def test_filename_type_error(self):
-        self.assertRaises(TypeError, GLib.file_get_contents, 23)
+    def test_wrong_types(self):
+        self.assertRaises(TypeError, GIMarshallingTests.filename_copy, 23)
+        self.assertRaises(TypeError, GIMarshallingTests.filename_copy, [])
+
+    def test_null(self):
+        self.assertTrue(GIMarshallingTests.filename_copy(None) is None)
+        self.assertRaises(TypeError, GIMarshallingTests.filename_exists, None)
+
+    def test_round_trip(self):
+        self.assertEqual(GIMarshallingTests.filename_copy(u"foo"), "foo")
+        self.assertEqual(GIMarshallingTests.filename_copy(b"foo"), "foo")
+
+    def test_contains_null(self):
+        self.assertRaises(
+            (ValueError, TypeError),
+            GIMarshallingTests.filename_copy, b"foo\x00")
+        self.assertRaises(
+            (ValueError, TypeError),
+            GIMarshallingTests.filename_copy, u"foo\x00")
+
+    def test_as_is_py2(self):
+        if not PY2:
+            return
+
+        values = [
+            b"foo",
+            b"\xff\xff",
+            b"\xc3\xb6\xc3\xa4\xc3\xbc",
+            b"\xed\xa0\xbd",
+            b"\xf0\x90\x80\x81",
+        ]
+
+        for v in values:
+            self.assertEqual(GIMarshallingTests.filename_copy(v), v)
+            self.assertEqual(GIMarshallingTests.filename_to_glib_repr(v), v)
+
+    def test_win32_surrogates(self):
+        if os.name != "nt":
+            return
+
+        copy = GIMarshallingTests.filename_copy
+        glib_repr = GIMarshallingTests.filename_to_glib_repr
+
+        if PY3:
+            self.assertEqual(copy(u"\ud83d"), u"\ud83d")
+            self.assertEqual(copy(u"\x61\uDC00"), u"\x61\uDC00")
+            self.assertEqual(copy(u"\uD800\uDC01"), u"\U00010001")
+            self.assertEqual(copy(u"\uD83D\x20\uDCA9"), u"\uD83D\x20\uDCA9")
+        else:
+            self.assertEqual(copy(u"\ud83d"), u"\ud83d".encode("utf-8"))
+            self.assertEqual(copy(u"\uD800\uDC01").decode("utf-8"),
+                             u"\U00010001")
+
+        self.assertEqual(glib_repr(u"\ud83d"), b"\xed\xa0\xbd")
+        self.assertEqual(glib_repr(u"\uD800\uDC01"), b"\xf0\x90\x80\x81")
+
+        self.assertEqual(
+            glib_repr(u"\uD800\uDBFF"), b"\xED\xA0\x80\xED\xAF\xBF")
+        self.assertEqual(
+            glib_repr(u"\uD800\uE000"), b"\xED\xA0\x80\xEE\x80\x80")
+        self.assertEqual(
+            glib_repr(u"\uD7FF\uDC00"), b"\xED\x9F\xBF\xED\xB0\x80")
+        self.assertEqual(glib_repr(u"\x61\uDC00"), b"\x61\xED\xB0\x80")
+        self.assertEqual(glib_repr(u"\uDC00"), b"\xED\xB0\x80")
+
+    def test_win32_bytes_py3(self):
+        if not (os.name == "nt" and PY3):
+            return
+
+        values = [
+            b"foo",
+            b"\xff\xff",
+            b"\xc3\xb6\xc3\xa4\xc3\xbc",
+            b"\xed\xa0\xbd",
+            b"\xf0\x90\x80\x81",
+        ]
+
+        for v in values:
+            try:
+                uni = v.decode(sys.getfilesystemencoding(), "surrogatepass")
+            except UnicodeDecodeError:
+                continue
+            self.assertEqual(GIMarshallingTests.filename_copy(v), uni)
+
+    def test_unix_various(self):
+        if os.name == "nt":
+            return
+
+        copy = GIMarshallingTests.filename_copy
+        glib_repr = GIMarshallingTests.filename_to_glib_repr
+
+        if PY3:
+            str_path = copy(b"\xff\xfe")
+            self.assertTrue(isinstance(str_path, str))
+            self.assertEqual(str_path, os.fsdecode(b"\xff\xfe"))
+            self.assertEqual(copy(str_path), str_path)
+            self.assertEqual(glib_repr(b"\xff\xfe"), b"\xff\xfe")
+            self.assertEqual(glib_repr(str_path), b"\xff\xfe")
+
+            # if getfilesystemencoding is ASCII, then we should fail like
+            # os.fsencode
+            try:
+                byte_path = os.fsencode(u"ä")
+            except UnicodeEncodeError:
+                self.assertRaises(UnicodeEncodeError, copy, u"ä")
+            else:
+                self.assertEqual(copy(u"ä"), u"ä")
+                self.assertEqual(glib_repr(u"ä"), byte_path)
+        else:
+            self.assertTrue(isinstance(copy(b"\xff\xfe"), bytes))
+            self.assertEqual(copy(u"foo"), b"foo")
+            self.assertTrue(isinstance(copy(u"foo"), bytes))
+            try:
+                byte_path = u"ä".encode(sys.getfilesystemencoding())
+            except UnicodeEncodeError:
+                self.assertRaises(UnicodeEncodeError, copy, u"ä")
+            else:
+                self.assertEqual(copy(u"ä"), byte_path)
+                self.assertEqual(glib_repr(u"ä"), byte_path)
+
+    @unittest.skip("glib can't handle non-unicode paths")
+    def test_win32_surrogates_exists(self):
+        if os.name != "nt":
+            return
+
+        path = os.path.join(self.workdir, u"\ud83d")
+        with open(path, "wb"):
+            self.assertTrue(os.path.exists(path))
+            self.assertTrue(GIMarshallingTests.filename_exists(path))
+        os.unlink(path)
+
+    def test_path_exists_various_types(self):
+        wd = self.workdir
+        wdb = os.fsencode(wd) if PY3 else wd
+
+        paths = [(wdb, b"foo-1"), (wd, u"foo-2"), (wd, u"öäü-3")]
+        if PY3:
+            paths.append((wd, os.fsdecode(b"\xff\xfe-4")))
+
+        if os.name != "nt":
+            paths.append((wdb, b"\xff\xfe-5"))
+
+        for (d, path) in paths:
+            path = os.path.join(d, path)
+            with open(path, "wb"):
+                self.assertTrue(GIMarshallingTests.filename_exists(path))
 
 
 class TestArray(unittest.TestCase):
@@ -771,7 +908,7 @@ class TestArray(unittest.TestCase):
 
     def test_array_uint8_in(self):
         GIMarshallingTests.array_uint8_in(Sequence([97, 98, 99, 100]))
-        GIMarshallingTests.array_uint8_in(_bytes("abcd"))
+        GIMarshallingTests.array_uint8_in(b"abcd")
 
     def test_array_string_in(self):
         GIMarshallingTests.array_string_in(['foo', 'bar'])
@@ -1333,9 +1470,14 @@ class TestGValue(unittest.TestCase):
 
     def test_gvalue_flat_array_in_item_marshal_failure(self):
         # Tests the failure to marshal 2^256 to a GValue mid-way through the array marshaling.
-        self.assertRaises(RuntimeError, GIMarshallingTests.gvalue_flat_array,
+        self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
                           [42, 2 ** 256, True])
 
+        self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
+                          [GLib.MAXINT + 1, "42", True])
+        self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
+                          [GLib.MININT - 1, "42", True])
+
     def test_gvalue_flat_array_out(self):
         values = GIMarshallingTests.return_gvalue_flat_array()
         self.assertEqual(values, [42, '42', True])
@@ -1486,6 +1628,8 @@ class TestEnum(unittest.TestCase):
 
         Run test under a locale which defines toupper('a') == 'a'
         '''
+        if sys.platform == "darwin" or os.name == "nt":
+            return
         cls.locale_dir = tempfile.mkdtemp()
         src = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'te_ST@nouppera')
         dest = os.path.join(cls.locale_dir, 'te_ST.UTF-8@nouppera')
@@ -1495,6 +1639,8 @@ class TestEnum(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        if sys.platform == "darwin" or os.name == "nt":
+            return
         locale.setlocale(locale.LC_ALL, 'C')
         shutil.rmtree(cls.locale_dir)
         try:
@@ -1989,23 +2135,23 @@ class TestStructure(unittest.TestCase):
     def test_repr(self):
         self.assertRegexpMatches(
             repr(GIMarshallingTests.PointerStruct()),
-            "<GIMarshallingTests.PointerStruct object at 0x[^\s]+ "
-            "\(void at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.PointerStruct object at 0x[^\s]+ "
+            r"\(void at 0x[^\s]+\)>")
 
         self.assertRegexpMatches(
             repr(GIMarshallingTests.SimpleStruct()),
-            "<GIMarshallingTests.SimpleStruct object at 0x[^\s]+ "
-            "\(void at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.SimpleStruct object at 0x[^\s]+ "
+            r"\(void at 0x[^\s]+\)>")
 
         self.assertRegexpMatches(
             repr(GIMarshallingTests.Union()),
-            "<GIMarshallingTests.Union object at 0x[^\s]+ "
-            "\(GIMarshallingTestsUnion at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.Union object at 0x[^\s]+ "
+            r"\(GIMarshallingTestsUnion at 0x[^\s]+\)>")
 
         self.assertRegexpMatches(
             repr(GIMarshallingTests.BoxedStruct()),
-            "<GIMarshallingTests.BoxedStruct object at 0x[^\s]+ "
-            "\(GIMarshallingTestsBoxedStruct at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.BoxedStruct object at 0x[^\s]+ "
+            r"\(GIMarshallingTestsBoxedStruct at 0x[^\s]+\)>")
 
 
 class TestGObject(unittest.TestCase):
@@ -2140,14 +2286,14 @@ class TestGObject(unittest.TestCase):
     def test_repr(self):
         self.assertRegexpMatches(
             repr(GIMarshallingTests.Object(int=42)),
-            "<GIMarshallingTests.Object object at 0x[^\s]+ "
-            "\(GIMarshallingTestsObject at 0x[^\s]+\)>")
+            r"<GIMarshallingTests.Object object at 0x[^\s]+ "
+            r"\(GIMarshallingTestsObject at 0x[^\s]+\)>")
 
     def test_nongir_repr(self):
         self.assertRegexpMatches(
             repr(Gio.File.new_for_path("")),
-            "<__gi__.GLocalFile object at 0x[^\s]+ "
-            "\(GLocalFile at 0x[^\s]+\)>")
+            r"<__gi__.GLocalFile object at 0x[^\s]+ "
+            r"\(GLocalFile at 0x[^\s]+\)>")
 
 # FIXME: Doesn't actually return the same object.
 #    def test_object_inout_same(self):
@@ -2553,7 +2699,7 @@ class TestMRO(unittest.TestCase):
             pass
 
         expected = (E, D, B, C, A, GIMarshallingTests.Object,
-                    GObject.Object, GObject.Object.__base__, gi._gi._gobject.GObject,
+                    GObject.Object, GObject.Object.__base__, gi._gi.GObject,
                     object)
         self.assertEqual(expected, E.__mro__)
 
index 05ab008..c7239ce 100644 (file)
@@ -1,9 +1,12 @@
 # -*- Mode: Python; py-indent-offset: 4 -*-
 # vim: tabstop=4 shiftwidth=4 expandtab
 
+import os
 import unittest
+import warnings
 
 import gi.overrides
+from gi import PyGIWarning
 from gi.repository import GLib, Gio
 
 from helper import ignore_gi_deprecation_warnings
@@ -39,6 +42,15 @@ class TestGio(unittest.TestCase):
         value = menu.get_item_attribute_value(0, "action", GLib.VariantType.new("s"))
         self.assertEqual("app.test", value.unpack())
 
+    def test_volume_monitor_warning(self):
+        with warnings.catch_warnings(record=True) as warn:
+            warnings.simplefilter('always')
+            Gio.VolumeMonitor()
+            self.assertEqual(len(warn), 1)
+            self.assertTrue(issubclass(warn[0].category, PyGIWarning))
+            self.assertRegexpMatches(str(warn[0].message),
+                                     '.*Gio\\.VolumeMonitor\\.get\\(\\).*')
+
 
 class TestGSettings(unittest.TestCase):
     def setUp(self):
@@ -142,6 +154,7 @@ class TestGSettings(unittest.TestCase):
                                              1)])
 
 
+@unittest.skipIf(os.name == "nt", "FIXME")
 class TestGFile(unittest.TestCase):
     def setUp(self):
         self.file, self.io_stream = Gio.File.new_tmp('TestGFile.XXXXXX')
@@ -206,6 +219,7 @@ class TestGFile(unittest.TestCase):
         self.assertFalse(self.file.query_exists(None))
 
 
+@unittest.skipIf(os.name == "nt", "crashes on Windows")
 class TestGApplication(unittest.TestCase):
     def test_command_line(self):
         class App(Gio.Application):
index 6331d11..78366a9 100644 (file)
@@ -1,6 +1,8 @@
 # -*- Mode: Python -*-
 # encoding: UTF-8
 
+import os
+import sys
 import unittest
 import os.path
 import warnings
@@ -9,23 +11,23 @@ import subprocess
 from gi.repository import GLib
 from gi import PyGIDeprecationWarning
 
-from compathelper import _unicode, _bytes
-
 
 class TestGLib(unittest.TestCase):
+
+    @unittest.skipIf(os.name == "nt", "no bash on Windows")
     def test_find_program_in_path(self):
         bash_path = GLib.find_program_in_path('bash')
-        self.assertTrue(bash_path.endswith('/bash'))
+        self.assertTrue(bash_path.endswith(os.path.sep + 'bash'))
         self.assertTrue(os.path.exists(bash_path))
 
         self.assertEqual(GLib.find_program_in_path('non existing'), None)
 
     def test_markup_escape_text(self):
-        self.assertEqual(GLib.markup_escape_text(_unicode('a&bä')), 'a&amp;bä')
-        self.assertEqual(GLib.markup_escape_text(_bytes('a&b\x05')), 'a&amp;b&#x5;')
+        self.assertEqual(GLib.markup_escape_text(u'a&bä'), 'a&amp;bä')
+        self.assertEqual(GLib.markup_escape_text(b'a&b\x05'), 'a&amp;b&#x5;')
 
         # with explicit length argument
-        self.assertEqual(GLib.markup_escape_text(_bytes('a\x05\x01\x02'), 2), 'a&#x5;')
+        self.assertEqual(GLib.markup_escape_text(b'a\x05\x01\x02', 2), 'a&#x5;')
 
     def test_progname(self):
         GLib.set_prgname('moo')
@@ -37,9 +39,9 @@ class TestGLib(unittest.TestCase):
 
     def test_xdg_dirs(self):
         d = GLib.get_user_data_dir()
-        self.assertTrue('/' in d, d)
+        self.assertTrue(os.path.sep in d, d)
         d = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP)
-        self.assertTrue('/' in d, d)
+        self.assertTrue(os.path.sep in d, d)
         with warnings.catch_warnings():
             warnings.simplefilter('ignore', PyGIDeprecationWarning)
 
@@ -48,7 +50,7 @@ class TestGLib(unittest.TestCase):
                              GLib.get_user_special_dir(GLib.USER_DIRECTORY_MUSIC))
 
         for d in GLib.get_system_config_dirs():
-            self.assertTrue('/' in d, d)
+            self.assertTrue(os.path.sep in d, d)
         for d in GLib.get_system_data_dirs():
             self.assertTrue(isinstance(d, str), d)
 
@@ -60,12 +62,12 @@ class TestGLib(unittest.TestCase):
         self.assertEqual(GLib.filename_display_basename('bar/foo'), 'foo')
 
         # this is locale dependent, so we cannot completely verify the result
-        res = GLib.filename_from_utf8(_unicode('aäb'))
+        res = GLib.filename_from_utf8(u'aäb')
         self.assertTrue(isinstance(res, bytes))
         self.assertGreaterEqual(len(res), 3)
 
         # with explicit length argument
-        self.assertEqual(GLib.filename_from_utf8(_unicode('aäb'), 1), b'a')
+        self.assertEqual(GLib.filename_from_utf8(u'aäb', 1), b'a')
 
     def test_uri_extract(self):
         res = GLib.uri_list_extract_uris('''# some comment
@@ -85,6 +87,7 @@ https://my.org/q?x=1&y=2
         self.assertTrue(isinstance(tm, float))
         self.assertGreater(tm, 1350000000.0)
 
+    @unittest.skipIf(sys.platform == "darwin", "fails on OSX")
     def test_main_loop(self):
         # note we do not test run() here, as we use this in countless other
         # tests
@@ -122,58 +125,74 @@ https://my.org/q?x=1&y=2
         self.assertTrue(context.pending() in [True, False])
         self.assertTrue(context.iteration(False) in [True, False])
 
+    @unittest.skipIf(os.name == "nt", "hangs")
     def test_io_add_watch_no_data(self):
         (r, w) = os.pipe()
         call_data = []
 
         def cb(fd, condition):
             call_data.append((fd, condition, os.read(fd, 1)))
+            if len(call_data) == 2:
+                ml.quit()
             return True
 
         # io_add_watch() takes an IOChannel, calling with an fd is deprecated
         with warnings.catch_warnings(record=True) as warn:
             warnings.simplefilter('always')
-            GLib.io_add_watch(r, GLib.IOCondition.IN, cb)
+            GLib.io_add_watch(r, GLib.IOCondition.IN, cb,
+                              priority=GLib.PRIORITY_HIGH)
             self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning))
 
+        def write():
+            os.write(w, b'a')
+            GLib.idle_add(lambda: os.write(w, b'b') and False)
+
         ml = GLib.MainLoop()
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, lambda: os.write(w, b'b') and False)
-        GLib.timeout_add(200, ml.quit)
+        GLib.idle_add(write)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(call_data, [(r, GLib.IOCondition.IN, b'a'),
                                      (r, GLib.IOCondition.IN, b'b')])
 
+    @unittest.skipIf(os.name == "nt", "hangs")
     def test_io_add_watch_with_data(self):
         (r, w) = os.pipe()
         call_data = []
 
         def cb(fd, condition, data):
             call_data.append((fd, condition, os.read(fd, 1), data))
+            if len(call_data) == 2:
+                ml.quit()
             return True
 
         # io_add_watch() takes an IOChannel, calling with an fd is deprecated
         with warnings.catch_warnings(record=True) as warn:
             warnings.simplefilter('always')
-            GLib.io_add_watch(r, GLib.IOCondition.IN, cb, 'moo')
+            GLib.io_add_watch(r, GLib.IOCondition.IN, cb, 'moo',
+                              priority=GLib.PRIORITY_HIGH)
             self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning))
 
+        def write():
+            os.write(w, b'a')
+            GLib.idle_add(lambda: os.write(w, b'b') and False)
+
         ml = GLib.MainLoop()
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, lambda: os.write(w, b'b') and False)
-        GLib.timeout_add(200, ml.quit)
+        GLib.idle_add(write)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(call_data, [(r, GLib.IOCondition.IN, b'a', 'moo'),
                                      (r, GLib.IOCondition.IN, b'b', 'moo')])
 
+    @unittest.skipIf(os.name == "nt", "hangs")
     def test_io_add_watch_with_multiple_data(self):
         (r, w) = os.pipe()
         call_data = []
 
         def cb(fd, condition, *user_data):
             call_data.append((fd, condition, os.read(fd, 1), user_data))
+            ml.quit()
             return True
 
         # io_add_watch() takes an IOChannel, calling with an fd is deprecated
@@ -183,17 +202,18 @@ https://my.org/q?x=1&y=2
             self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning))
 
         ml = GLib.MainLoop()
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, ml.quit)
+        GLib.idle_add(lambda: os.write(w, b'a') and False)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(call_data, [(r, GLib.IOCondition.IN, b'a', ('moo', 'foo'))])
 
+    @unittest.skipIf(os.name == "nt", "no shell on Windows")
     def test_io_add_watch_pyfile(self):
         call_data = []
 
-        cmd = subprocess.Popen('sleep 0.1; echo hello; sleep 0.2; echo world',
-                               shell=True, stdout=subprocess.PIPE)
+        cmd = subprocess.Popen('echo hello; echo world',
+                               shell=True, bufsize=0, stdout=subprocess.PIPE)
 
         def cb(file, condition):
             call_data.append((file, condition, file.readline()))
index 39a277b..c380d72 100644 (file)
@@ -8,22 +8,26 @@ import warnings
 from gi.repository import GObject, GLib
 from gi import PyGIDeprecationWarning
 from gi.module import get_introspection_module
-
-import gi
-_gobject = gi._gi._gobject
+from gi import _gi
 
 import testhelper
 
 
 class TestGObjectAPI(unittest.TestCase):
+
+    def test_call_method_uninitialized_instance(self):
+        obj = GObject.Object.__new__(GObject.Object)
+        with self.assertRaisesRegex(RuntimeError, '.*is not initialized'):
+            obj.notify("foo")
+
     def test_gobject_inheritance(self):
         # GObject.Object is a class hierarchy as follows:
         # overrides.Object -> introspection.Object -> static.GObject
         GIObjectModule = get_introspection_module('GObject')
         self.assertTrue(issubclass(GObject.Object, GIObjectModule.Object))
-        self.assertTrue(issubclass(GIObjectModule.Object, _gobject.GObject))
+        self.assertTrue(issubclass(GIObjectModule.Object, _gi.GObject))
 
-        self.assertEqual(_gobject.GObject.__gtype__, GObject.TYPE_OBJECT)
+        self.assertEqual(_gi.GObject.__gtype__, GObject.TYPE_OBJECT)
         self.assertEqual(GIObjectModule.Object.__gtype__, GObject.TYPE_OBJECT)
         self.assertEqual(GObject.Object.__gtype__, GObject.TYPE_OBJECT)
 
index dac48af..044117d 100644 (file)
@@ -8,11 +8,7 @@ import gi.overrides
 import gi.module
 import gi.importer
 
-try:
-    from gi.repository import Regress
-    Regress  # pyflakes
-except ImportError:
-    Regress = None
+from gi.repository import Regress
 
 
 class TestOverrides(unittest.TestCase):
@@ -27,7 +23,6 @@ class TestOverrides(unittest.TestCase):
         except TypeError as e:
             self.assertTrue('Can not override a type MyClass' in str(e))
 
-    @unittest.skipUnless(Regress, 'built without cairo support')
     def test_separate_path(self):
         # Regress override is in tests/gi/overrides, separate from gi/overrides
         # https://bugzilla.gnome.org/show_bug.cgi?id=680913
index 5980a66..95b8d1f 100644 (file)
@@ -1,19 +1,21 @@
 # -*- Mode: Python -*-
 # encoding: UTF-8
-from __future__ import unicode_literals
 
+import os
 import unittest
 import tempfile
 import os.path
-import fcntl
 import shutil
 import warnings
 
+try:
+    import fcntl
+except ImportError:
+    fcntl = None
+
 from gi.repository import GLib
 from gi import PyGIDeprecationWarning
 
-from compathelper import _unicode
-
 
 class IOChannel(unittest.TestCase):
     def setUp(self):
@@ -21,7 +23,7 @@ class IOChannel(unittest.TestCase):
 
         self.testutf8 = os.path.join(self.workdir, 'testutf8.txt')
         with open(self.testutf8, 'wb') as f:
-            f.write('''hello ♥ world
+            f.write(u'''hello ♥ world
 second line
 
 À demain!'''.encode('UTF-8'))
@@ -42,11 +44,11 @@ second line
         ch = GLib.IOChannel(filename=self.testutf8)
         self.assertEqual(ch.get_encoding(), 'UTF-8')
         self.assertTrue(ch.get_close_on_unref())
-        self.assertEqual(_unicode(ch.readline()), 'hello ♥ world\n')
+        self.assertEqual(ch.readline(), 'hello ♥ world\n')
         self.assertEqual(ch.get_buffer_condition(), GLib.IOCondition.IN)
         self.assertEqual(ch.readline(), 'second line\n')
         self.assertEqual(ch.readline(), '\n')
-        self.assertEqual(_unicode(ch.readline()), 'À demain!')
+        self.assertEqual(ch.readline(), 'À demain!')
         self.assertEqual(ch.get_buffer_condition(), 0)
         self.assertEqual(ch.readline(), '')
         ch.shutdown(True)
@@ -55,10 +57,10 @@ second line
         ch = GLib.IOChannel(filename=self.testlatin1, mode='r')
         ch.set_encoding('latin1')
         self.assertEqual(ch.get_encoding(), 'latin1')
-        self.assertEqual(_unicode(ch.readline()), 'hellø world\n')
+        self.assertEqual(ch.readline(), 'hellø world\n')
         self.assertEqual(ch.readline(), 'second line\n')
         self.assertEqual(ch.readline(), '\n')
-        self.assertEqual(_unicode(ch.readline()), 'À demain!')
+        self.assertEqual(ch.readline(), 'À demain!')
         ch.shutdown(True)
 
     def test_file_iter(self):
@@ -67,7 +69,7 @@ second line
         for item in ch:
             items.append(item)
         self.assertEqual(len(items), 4)
-        self.assertEqual(_unicode(items[0]), 'hello ♥ world\n')
+        self.assertEqual(items[0], 'hello ♥ world\n')
         ch.shutdown(True)
 
     def test_file_readlines(self):
@@ -77,8 +79,8 @@ second line
         # empty one
         self.assertGreaterEqual(len(lines), 4)
         self.assertLessEqual(len(lines), 5)
-        self.assertEqual(_unicode(lines[0]), 'hello ♥ world\n')
-        self.assertEqual(_unicode(lines[3]), 'À demain!')
+        self.assertEqual(lines[0], 'hello ♥ world\n')
+        self.assertEqual(lines[3], 'À demain!')
         if len(lines) == 4:
             self.assertEqual(lines[4], '')
 
@@ -112,6 +114,7 @@ second line
 
         # invalid whence value
         self.assertRaises(ValueError, ch.seek, 0, 3)
+        ch.shutdown(True)
 
     def test_file_write(self):
         ch = GLib.IOChannel(filename=self.testout, mode='w')
@@ -124,7 +127,7 @@ second line
         ch.shutdown(True)
 
         with open(self.testout, 'rb') as f:
-            self.assertEqual(f.read().decode('latin1'), 'hellø world\nÀ demain!')
+            self.assertEqual(f.read().decode('latin1'), u'hellø world\nÀ demain!')
 
     def test_file_writelines(self):
         ch = GLib.IOChannel(filename=self.testout, mode='w')
@@ -167,6 +170,7 @@ second line
         self.assertEqual(reader.read(), b'ghi')
         reader.shutdown(True)
 
+    @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows")
     def test_fd_read(self):
         (r, w) = os.pipe()
 
@@ -186,6 +190,7 @@ second line
 
         ch.shutdown(True)
 
+    @unittest.skipUnless(fcntl, "no fcntl")
     def test_fd_write(self):
         (r, w) = os.pipe()
         fcntl.fcntl(r, fcntl.F_SETFL, fcntl.fcntl(r, fcntl.F_GETFL) | os.O_NONBLOCK)
@@ -203,6 +208,7 @@ second line
         self.assertEqual(os.read(r, 10), b'\x03\x04')
         os.close(r)
 
+    @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows")
     def test_deprecated_method_add_watch_no_data(self):
         (r, w) = os.pipe()
 
@@ -216,23 +222,28 @@ second line
             self.assertEqual(channel, ch)
             self.assertEqual(condition, GLib.IOCondition.IN)
             cb_reads.append(channel.read())
+            if len(cb_reads) == 2:
+                ml.quit()
             return True
 
         # io_add_watch() method is deprecated, use GLib.io_add_watch
         with warnings.catch_warnings(record=True) as warn:
             warnings.simplefilter('always')
-            ch.add_watch(GLib.IOCondition.IN, cb)
+            ch.add_watch(GLib.IOCondition.IN, cb, priority=GLib.PRIORITY_HIGH)
             self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning))
 
-        ml = GLib.MainLoop()
+        def write():
+            os.write(w, b'a')
+            GLib.idle_add(lambda: os.write(w, b'b') and False)
 
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, lambda: os.write(w, b'b') and False)
-        GLib.timeout_add(200, ml.quit)
+        ml = GLib.MainLoop()
+        GLib.idle_add(write)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(cb_reads, [b'a', b'b'])
 
+    @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows")
     def test_deprecated_method_add_watch_data_priority(self):
         (r, w) = os.pipe()
 
@@ -247,6 +258,8 @@ second line
             self.assertEqual(condition, GLib.IOCondition.IN)
             self.assertEqual(data, 'hello')
             cb_reads.append(channel.read())
+            if len(cb_reads) == 2:
+                ml.quit()
             return True
 
         ml = GLib.MainLoop()
@@ -259,13 +272,17 @@ second line
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_HIGH)
 
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, lambda: os.write(w, b'b') and False)
-        GLib.timeout_add(200, ml.quit)
+        def write():
+            os.write(w, b'a')
+            GLib.idle_add(lambda: os.write(w, b'b') and False)
+
+        GLib.idle_add(write)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(cb_reads, [b'a', b'b'])
 
+    @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows")
     def test_add_watch_no_data(self):
         (r, w) = os.pipe()
 
@@ -279,6 +296,8 @@ second line
             self.assertEqual(channel, ch)
             self.assertEqual(condition, GLib.IOCondition.IN)
             cb_reads.append(channel.read())
+            if len(cb_reads) == 2:
+                ml.quit()
             return True
 
         id = GLib.io_add_watch(ch, GLib.PRIORITY_HIGH, GLib.IOCondition.IN, cb)
@@ -286,13 +305,18 @@ second line
         ml = GLib.MainLoop()
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_HIGH)
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, lambda: os.write(w, b'b') and False)
-        GLib.timeout_add(200, ml.quit)
+
+        def write():
+            os.write(w, b'a')
+            GLib.idle_add(lambda: os.write(w, b'b') and False)
+
+        GLib.idle_add(write)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(cb_reads, [b'a', b'b'])
 
+    @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows")
     def test_add_watch_with_data(self):
         (r, w) = os.pipe()
 
@@ -307,6 +331,8 @@ second line
             self.assertEqual(condition, GLib.IOCondition.IN)
             self.assertEqual(data, 'hello')
             cb_reads.append(channel.read())
+            if len(cb_reads) == 2:
+                ml.quit()
             return True
 
         id = GLib.io_add_watch(ch, GLib.PRIORITY_HIGH, GLib.IOCondition.IN, cb, 'hello')
@@ -314,13 +340,18 @@ second line
         ml = GLib.MainLoop()
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_HIGH)
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, lambda: os.write(w, b'b') and False)
-        GLib.timeout_add(200, ml.quit)
+
+        def write():
+            os.write(w, b'a')
+            GLib.idle_add(lambda: os.write(w, b'b') and False)
+
+        GLib.idle_add(write)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(cb_reads, [b'a', b'b'])
 
+    @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows")
     def test_add_watch_with_multi_data(self):
         (r, w) = os.pipe()
 
@@ -337,6 +368,8 @@ second line
             self.assertEqual(data2, 'b')
             self.assertEqual(data3, 'c')
             cb_reads.append(channel.read())
+            if len(cb_reads) == 2:
+                ml.quit()
             return True
 
         id = GLib.io_add_watch(ch, GLib.PRIORITY_HIGH, GLib.IOCondition.IN, cb,
@@ -345,13 +378,18 @@ second line
         ml = GLib.MainLoop()
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_HIGH)
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, lambda: os.write(w, b'b') and False)
-        GLib.timeout_add(200, ml.quit)
+
+        def write():
+            os.write(w, b'a')
+            GLib.idle_add(lambda: os.write(w, b'b') and False)
+
+        GLib.idle_add(write)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(cb_reads, [b'a', b'b'])
 
+    @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows")
     def test_deprecated_add_watch_no_data(self):
         (r, w) = os.pipe()
 
@@ -365,6 +403,8 @@ second line
             self.assertEqual(channel, ch)
             self.assertEqual(condition, GLib.IOCondition.IN)
             cb_reads.append(channel.read())
+            if len(cb_reads) == 2:
+                ml.quit()
             return True
 
         with warnings.catch_warnings(record=True) as warn:
@@ -375,13 +415,18 @@ second line
         ml = GLib.MainLoop()
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_HIGH)
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, lambda: os.write(w, b'b') and False)
-        GLib.timeout_add(200, ml.quit)
+
+        def write():
+            os.write(w, b'a')
+            GLib.idle_add(lambda: os.write(w, b'b') and False)
+
+        GLib.idle_add(write)
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(cb_reads, [b'a', b'b'])
 
+    @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows")
     def test_deprecated_add_watch_with_data(self):
         (r, w) = os.pipe()
 
@@ -396,6 +441,8 @@ second line
             self.assertEqual(condition, GLib.IOCondition.IN)
             self.assertEqual(data, 'hello')
             cb_reads.append(channel.read())
+            if len(cb_reads) == 2:
+                ml.quit()
             return True
 
         with warnings.catch_warnings(record=True) as warn:
@@ -407,9 +454,14 @@ second line
         ml = GLib.MainLoop()
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_HIGH)
-        GLib.timeout_add(10, lambda: os.write(w, b'a') and False)
-        GLib.timeout_add(100, lambda: os.write(w, b'b') and False)
-        GLib.timeout_add(200, ml.quit)
+
+        def write():
+            os.write(w, b'a')
+            GLib.idle_add(lambda: os.write(w, b'b') and False)
+
+        GLib.idle_add(write)
+
+        GLib.timeout_add(2000, ml.quit)
         ml.run()
 
         self.assertEqual(cb_reads, [b'a', b'b'])
index 44197b3..fda6787 100644 (file)
@@ -4,21 +4,14 @@ import os
 import sys
 import select
 import signal
-import time
 import unittest
 
-try:
-    from _thread import start_new_thread
-    start_new_thread  # pyflakes
-except ImportError:
-    # Python 2
-    from thread import start_new_thread
 from gi.repository import GLib
 
-from compathelper import _bytes
-
 
 class TestMainLoop(unittest.TestCase):
+
+    @unittest.skipUnless(hasattr(os, "fork"), "no os.fork available")
     def test_exception_handling(self):
         pipe_r, pipe_w = os.pipe()
 
@@ -37,7 +30,7 @@ class TestMainLoop(unittest.TestCase):
         GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, child_died, loop)
 
         os.close(pipe_r)
-        os.write(pipe_w, _bytes("Y"))
+        os.write(pipe_w, b"Y")
         os.close(pipe_w)
 
         def excepthook(type, value, traceback):
@@ -60,33 +53,24 @@ class TestMainLoop(unittest.TestCase):
         #
         self.assertFalse(got_exception)
 
-    def test_concurrency(self):
-        def on_usr1(signum, frame):
-            pass
-
-        try:
-            # create a thread which will terminate upon SIGUSR1 by way of
-            # interrupting sleep()
-            orig_handler = signal.signal(signal.SIGUSR1, on_usr1)
-            start_new_thread(time.sleep, (10,))
-
-            # now create two main loops
-            loop1 = GLib.MainLoop()
-            loop2 = GLib.MainLoop()
-            GLib.timeout_add(100, lambda: os.kill(os.getpid(), signal.SIGUSR1))
-            GLib.timeout_add(500, loop1.quit)
-            loop1.run()
-            loop2.quit()
-        finally:
-            signal.signal(signal.SIGUSR1, orig_handler)
-
+    @unittest.skipUnless(hasattr(os, "fork"), "no os.fork available")
     def test_sigint(self):
+        r, w = os.pipe()
         pid = os.fork()
         if pid == 0:
-            time.sleep(0.5)
+            # wait for the parent process loop to start
+            os.read(r, 1)
+            os.close(r)
+
             os.kill(os.getppid(), signal.SIGINT)
             os._exit(0)
 
+        def notify_child():
+            # tell the child that it can kill the parent
+            os.write(w, b"X")
+            os.close(w)
+
+        GLib.idle_add(notify_child)
         loop = GLib.MainLoop()
         try:
             loop.run()
index a0ffac4..0974d35 100644 (file)
@@ -1,6 +1,8 @@
 # -*- Mode: Python; py-indent-offset: 4 -*-
 # vim: tabstop=4 shiftwidth=4 expandtab
 
+import os
+import sys
 import unittest
 
 import gi.overrides
@@ -17,6 +19,9 @@ from helper import capture_glib_deprecation_warnings
 
 @unittest.skipUnless(Gdk, 'Gdk not available')
 class TestGdk(unittest.TestCase):
+
+    @unittest.skipIf(sys.platform == "darwin" or os.name == "nt", "crashes")
+    @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
     def test_constructor(self):
         attribute = Gdk.WindowAttr()
         attribute.window_type = Gdk.WindowType.CHILD
@@ -25,6 +30,7 @@ class TestGdk(unittest.TestCase):
         window = Gdk.Window(None, attribute, attributes_mask)
         self.assertEqual(window.get_window_type(), Gdk.WindowType.CHILD)
 
+    @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
     def test_color(self):
         color = Gdk.Color(100, 200, 300)
         self.assertEqual(color.red, 100)
@@ -34,6 +40,7 @@ class TestGdk(unittest.TestCase):
             self.assertEqual(color, Gdk.Color(100, 200, 300))
         self.assertNotEqual(color, Gdk.Color(1, 2, 3))
 
+    @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
     def test_color_floats(self):
         self.assertEqual(Gdk.Color(13107, 21845, 65535),
                          Gdk.Color.from_floats(0.2, 1.0 / 3.0, 1.0))
@@ -100,6 +107,7 @@ class TestGdk(unittest.TestCase):
         event = Gdk.Event.new(Gdk.EventType.CONFIGURE)
         self.assertTrue("CONFIGURE" in repr(event))
 
+    @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
     def test_event_structures(self):
         def button_press_cb(button, event):
             self.assertTrue(isinstance(event, Gdk.EventButton))
@@ -115,13 +123,15 @@ class TestGdk(unittest.TestCase):
         b = Gtk.Button()
         b.connect('button-press-event', button_press_cb)
         w.add(b)
-        w.show_all()
+        b.show()
+        b.realize()
         Gdk.test_simulate_button(b.get_window(),
                                  2, 5,
                                  0,
                                  Gdk.ModifierType.CONTROL_MASK,
                                  Gdk.EventType.BUTTON_PRESS)
 
+    @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
     def test_cursor(self):
         self.assertEqual(Gdk.Cursor, gi.overrides.Gdk.Cursor)
         with capture_glib_deprecation_warnings():
@@ -168,6 +178,7 @@ class TestGdk(unittest.TestCase):
         self.assertEqual(str(Gdk.ModifierType.RELEASE_MASK | Gdk.ModifierType.META_MASK),
                          '<flags GDK_META_MASK | GDK_RELEASE_MASK of type Gdk.ModifierType>')
 
+    @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
     def test_color_parse(self):
         with capture_glib_deprecation_warnings():
             c = Gdk.color_parse('#00FF80')
@@ -176,6 +187,7 @@ class TestGdk(unittest.TestCase):
         self.assertEqual(c.blue, 32896)
         self.assertEqual(Gdk.color_parse('bogus'), None)
 
+    @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
     def test_color_representations(self):
         # __repr__ should generate a string which is parsable when possible
         # http://docs.python.org/2/reference/datamodel.html#object.__repr__
index 6562413..61b7dc0 100644 (file)
@@ -8,23 +8,20 @@ import time
 import sys
 import warnings
 
-from compathelper import _unicode, _bytes
 from helper import ignore_gi_deprecation_warnings, capture_glib_warnings
 
-import gi
 import gi.overrides
 import gi.types
 from gi.repository import GLib, GObject
 
 try:
-    gi.require_version('Gtk', '3.0')
-    gi.require_version('GdkPixbuf', '2.0')
     from gi.repository import Gtk, GdkPixbuf, Gdk
-    Gtk  # pyflakes
     PyGTKDeprecationWarning = Gtk.PyGTKDeprecationWarning
-except (ValueError, ImportError):
+except ImportError:
     Gtk = None
     PyGTKDeprecationWarning = None
+    GdkPixbuf = None
+    Gdk = None
 
 
 @contextlib.contextmanager
@@ -79,6 +76,7 @@ class TestGtk(unittest.TestCase):
         labels = [x for x in box]
         self.assertEqual(labels, [label, label2])
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_actions(self):
         self.assertEqual(Gtk.Action, gi.overrides.Gtk.Action)
         action = Gtk.Action(name="test", label="Test", tooltip="Test Action", stock_id=Gtk.STOCK_COPY)
@@ -95,6 +93,7 @@ class TestGtk(unittest.TestCase):
         self.assertEqual(action.get_stock_id(), Gtk.STOCK_COPY)
         self.assertEqual(action.get_current_value(), 1)
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_actiongroup(self):
         self.assertEqual(Gtk.ActionGroup, gi.overrides.Gtk.ActionGroup)
 
@@ -136,6 +135,7 @@ class TestGtk(unittest.TestCase):
             expected_results.remove(a)
             action.activate()
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_uimanager(self):
         self.assertEqual(Gtk.UIManager, gi.overrides.Gtk.UIManager)
         ui = Gtk.UIManager()
@@ -155,6 +155,7 @@ class TestGtk(unittest.TestCase):
         self.assertEqual(ag, groups[-2])
         self.assertEqual(ag2, groups[-1])
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_uimanager_nonascii(self):
         ui = Gtk.UIManager()
         ui.add_ui_from_string(b'<ui><menubar name="menub\xc3\xa6r1" /></ui>'.decode('UTF-8'))
@@ -195,10 +196,11 @@ class TestGtk(unittest.TestCase):
 
     def test_dialog_classes(self):
         self.assertEqual(Gtk.Dialog, gi.overrides.Gtk.Dialog)
-        self.assertEqual(Gtk.ColorSelectionDialog, gi.overrides.Gtk.ColorSelectionDialog)
         self.assertEqual(Gtk.FileChooserDialog, gi.overrides.Gtk.FileChooserDialog)
-        self.assertEqual(Gtk.FontSelectionDialog, gi.overrides.Gtk.FontSelectionDialog)
         self.assertEqual(Gtk.RecentChooserDialog, gi.overrides.Gtk.RecentChooserDialog)
+        if Gtk._version != "4.0":
+            self.assertEqual(Gtk.ColorSelectionDialog, gi.overrides.Gtk.ColorSelectionDialog)
+            self.assertEqual(Gtk.FontSelectionDialog, gi.overrides.Gtk.FontSelectionDialog)
 
     def test_dialog_base(self):
         dialog = Gtk.Dialog(title='Foo', modal=True)
@@ -266,13 +268,13 @@ class TestGtk(unittest.TestCase):
             self.assertRegexpMatches(str(warn[0].message),
                                      '.*ButtonsType.*add_buttons.*')
 
-        dialog.add_buttons('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
+        dialog.add_buttons('test-button2', 2, 'gtk-close', Gtk.ResponseType.CLOSE)
         button = dialog.get_widget_for_response(1)
         self.assertEqual('test-button1', button.get_label())
         button = dialog.get_widget_for_response(2)
         self.assertEqual('test-button2', button.get_label())
         button = dialog.get_widget_for_response(Gtk.ResponseType.CLOSE)
-        self.assertEqual(Gtk.STOCK_CLOSE, button.get_label())
+        self.assertEqual('gtk-close', button.get_label())
 
     def test_about_dialog(self):
         dialog = Gtk.AboutDialog()
@@ -304,6 +306,7 @@ class TestGtk(unittest.TestCase):
         self.assertEqual(dialog.get_property('secondary-text'), '2nd markup')
         self.assertTrue(dialog.get_property('secondary-use-markup'))
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_color_selection_dialog(self):
         dialog = Gtk.ColorSelectionDialog(title="color selection dialog test")
         self.assertTrue(isinstance(dialog, Gtk.Dialog))
@@ -331,6 +334,7 @@ class TestGtk(unittest.TestCase):
         action = dialog.get_property('action')
         self.assertEqual(Gtk.FileChooserAction.OPEN, action)
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_font_selection_dialog(self):
         dialog = Gtk.FontSelectionDialog(title="font selection dialog test")
         self.assertTrue(isinstance(dialog, Gtk.Dialog))
@@ -367,19 +371,21 @@ class TestGtk(unittest.TestCase):
         self.assertTrue(isinstance(button, Gtk.Container))
         self.assertTrue(isinstance(button, Gtk.Widget))
 
-        # Using stock items causes hard warning in devel versions of GTK+.
-        with capture_glib_warnings(allow_warnings=True):
-            button = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)
+        if Gtk._version != "4.0":
+            # Using stock items causes hard warning in devel versions of GTK+.
+            with capture_glib_warnings(allow_warnings=True):
+                button = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)
 
-        self.assertEqual(Gtk.STOCK_CLOSE, button.get_label())
-        self.assertTrue(button.get_use_stock())
-        self.assertTrue(button.get_use_underline())
+            self.assertEqual(Gtk.STOCK_CLOSE, button.get_label())
+            self.assertTrue(button.get_use_stock())
+            self.assertTrue(button.get_use_underline())
 
-        # test Gtk.Button use_stock
-        button = Gtk.Button(label=Gtk.STOCK_CLOSE, use_stock=True, use_underline=True)
-        self.assertEqual(Gtk.STOCK_CLOSE, button.get_label())
-        self.assertTrue(button.get_use_stock())
-        self.assertTrue(button.get_use_underline())
+            # test Gtk.Button use_stock
+            button = Gtk.Button(label=Gtk.STOCK_CLOSE, use_stock=True,
+                                use_underline=True)
+            self.assertEqual(Gtk.STOCK_CLOSE, button.get_label())
+            self.assertTrue(button.get_use_stock())
+            self.assertTrue(button.get_use_underline())
 
         # test Gtk.LinkButton
         button = Gtk.LinkButton(uri='http://www.Gtk.org', label='Gtk')
@@ -457,6 +463,7 @@ class TestGtk(unittest.TestCase):
         adjustment = Gtk.Adjustment()
         self.adjustment_check(adjustment)
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_table(self):
         table = Gtk.Table()
         self.assertTrue(isinstance(table, Gtk.Table))
@@ -518,7 +525,8 @@ class TestGtk(unittest.TestCase):
         widget.drag_source_add_uri_targets()
         widget.drag_source_set_icon_name("_About")
         widget.drag_source_set_icon_pixbuf(GdkPixbuf.Pixbuf())
-        widget.drag_source_set_icon_stock(Gtk.STOCK_ABOUT)
+        if Gtk._version != "4.0":
+            widget.drag_source_set_icon_stock(Gtk.STOCK_ABOUT)
         widget.drag_source_get_target_list()
         widget.drag_source_set_target_list(None)
         widget.drag_source_set_target_list(Gtk.TargetList.new([Gtk.TargetEntry.new('test', 0, 0)]))
@@ -526,7 +534,8 @@ class TestGtk(unittest.TestCase):
 
         # these methods cannot be called because they require a valid drag on
         # a real GdkWindow. So we only check that they exist and are callable.
-        self.assertTrue(hasattr(widget, 'drag_dest_set_proxy'))
+        if Gtk._version != "4.0":
+            self.assertTrue(hasattr(widget, 'drag_dest_set_proxy'))
         self.assertTrue(hasattr(widget, 'drag_get_data'))
 
     def test_drag_target_list(self):
@@ -561,6 +570,7 @@ class TestGtk(unittest.TestCase):
         treeview.enable_model_drag_dest(mixed_target_list,
                                         Gdk.DragAction.DEFAULT | Gdk.DragAction.MOVE)
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_scrollbar(self):
         adjustment = Gtk.Adjustment()
 
@@ -583,6 +593,7 @@ class TestGtk(unittest.TestCase):
         iconview = Gtk.IconView(model=model)
         self.assertEqual(iconview.props.model, model)
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_toolbutton(self):
         # PyGTK compat
 
@@ -599,6 +610,13 @@ class TestGtk(unittest.TestCase):
         self.assertEqual(button.props.label, 'mylabel')
         self.assertEqual(button.props.icon_widget, icon)
 
+    def test_toolbutton_gtk4(self):
+        icon = Gtk.Image.new()
+        button = Gtk.ToolButton(label='mylabel', icon_widget=icon)
+        self.assertEqual(button.props.label, 'mylabel')
+        self.assertEqual(button.props.icon_widget, icon)
+
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_iconset(self):
         Gtk.IconSet()
         pixbuf = GdkPixbuf.Pixbuf()
@@ -614,6 +632,7 @@ class TestGtk(unittest.TestCase):
         self.assertEqual(viewport.props.vadjustment, vadjustment)
         self.assertEqual(viewport.props.hadjustment, hadjustment)
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_stock_lookup(self):
         stock_item = Gtk.stock_lookup('gtk-ok')
         self.assertEqual(type(stock_item), Gtk.StockItem)
@@ -622,13 +641,14 @@ class TestGtk(unittest.TestCase):
 
     def test_gtk_main(self):
         # with no arguments
-        GLib.timeout_add(100, Gtk.main_quit)
+        GLib.idle_add(Gtk.main_quit)
         Gtk.main()
 
         # overridden function ignores its arguments
-        GLib.timeout_add(100, Gtk.main_quit, 'hello')
+        GLib.idle_add(Gtk.main_quit, 'hello')
         Gtk.main()
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_widget_render_icon(self):
         button = Gtk.Button(label='OK')
         pixbuf = button.render_icon(Gtk.STOCK_OK, Gtk.IconSize.BUTTON)
@@ -636,6 +656,7 @@ class TestGtk(unittest.TestCase):
 
 
 @unittest.skipUnless(Gtk, 'Gtk not available')
+@unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
 class TestWidget(unittest.TestCase):
     def test_style_get_property_gvalue(self):
         button = Gtk.Button()
@@ -664,6 +685,7 @@ class TestWidget(unittest.TestCase):
             button.style_get_property('not-a-valid-style-property')
 
 
+@unittest.skipIf(sys.platform == "darwin", "hangs")
 @unittest.skipUnless(Gtk, 'Gtk not available')
 class TestSignals(unittest.TestCase):
     def test_class_closure_override_with_aliased_type(self):
@@ -907,7 +929,7 @@ class TestTreeModel(unittest.TestCase):
                                                 GLib.MININT64,
                                                 0xffffffffffffffff,
                                                 254,
-                                                _bytes('a')
+                                                b'a'
                                                 ))
         # test set
         parent = tree_store.append(parent)
@@ -929,7 +951,7 @@ class TestTreeModel(unittest.TestCase):
                        11, GLib.MININT64,
                        12, 0xffffffffffffffff,
                        13, 254,
-                       14, _bytes('a'))
+                       14, b'a')
 
         parent = tree_store.append(parent)
         i = 98
@@ -949,7 +971,7 @@ class TestTreeModel(unittest.TestCase):
                                 11: GLib.MININT64,
                                 12: 0xffffffffffffffff,
                                 13: 254,
-                                14: _bytes('a')})
+                                14: b'a'})
 
         parent = tree_store.append(parent)
         i = 99
@@ -970,7 +992,7 @@ class TestTreeModel(unittest.TestCase):
                                 GLib.MININT64,
                                 0xffffffffffffffff,
                                 254,
-                                _bytes('a')))
+                                b'a'))
 
         # len gets the number of children in the root node
         # since we kept appending to the previous node
@@ -1080,7 +1102,7 @@ class TestTreeModel(unittest.TestCase):
                                bool(i % 2)))
 
         i = 93
-        label = _unicode('this is row #93')
+        label = u'this is row #93'
         treeiter = list_store.append()
         list_store.set_value(treeiter, 0, i)
         list_store.set_value(treeiter, 1, label)
@@ -1104,7 +1126,7 @@ class TestTreeModel(unittest.TestCase):
 
         # test automatic unicode->str conversion
         i = 94
-        label = _unicode('this is row #94')
+        label = u'this is row #94'
         treeiter = list_store.append((i,
                                       label,
                                       TestGtk.TestClass(self, i, label),
@@ -1698,6 +1720,7 @@ class TestTreeModel(unittest.TestCase):
         self.assertTrue(filt is not None)
 
 
+@unittest.skipIf(sys.platform == "darwin", "hangs")
 @unittest.skipUnless(Gtk, 'Gtk not available')
 class TestTreeView(unittest.TestCase):
     def test_tree_view(self):
@@ -1852,21 +1875,43 @@ class TestTextBuffer(unittest.TestCase):
         self.assertTrue(sel[1].equal(end))
 
         buffer.set_text('')
+        buffer.insert_with_tags(buffer.get_start_iter(), 'HelloHello')
+        start, end = buffer.get_bounds()
+        text = buffer.get_text(start, end, False)
+        self.assertEqual(text, 'HelloHello')
+
+        buffer.set_text('')
+        buffer.insert_with_tags_by_name(buffer.get_start_iter(), 'HelloHello')
+        start, end = buffer.get_bounds()
+        text = buffer.get_text(start, end, False)
+        self.assertEqual(text, 'HelloHello')
+
+        try:
+            starts_tag = Gtk.TextIter.starts_tag
+        except AttributeError:
+            starts_tag = Gtk.TextIter.begins_tag
+
+        buffer.set_text('')
         buffer.insert_with_tags(buffer.get_start_iter(), 'HelloHello', tag)
         (start, end) = buffer.get_bounds()
-        self.assertTrue(start.begins_tag(tag))
+        self.assertTrue(starts_tag(start, tag))
         self.assertTrue(start.has_tag(tag))
 
         buffer.set_text('')
         buffer.insert_with_tags_by_name(buffer.get_start_iter(), 'HelloHello', 'title')
         (start, end) = buffer.get_bounds()
-        self.assertTrue(start.begins_tag(tag))
+        self.assertTrue(starts_tag(start, tag))
         self.assertTrue(start.has_tag(tag))
 
         self.assertRaises(ValueError, buffer.insert_with_tags_by_name,
                           buffer.get_start_iter(), 'HelloHello', 'unknowntag')
 
     def test_text_iter(self):
+        try:
+            starts_tag = Gtk.TextIter.starts_tag
+        except AttributeError:
+            starts_tag = Gtk.TextIter.begins_tag
+
         self.assertEqual(Gtk.TextIter, gi.overrides.Gtk.TextIter)
         buffer = Gtk.TextBuffer()
         buffer.set_text('Hello Jane Hello Bob')
@@ -1874,12 +1919,12 @@ class TestTextBuffer(unittest.TestCase):
         (start, end) = buffer.get_bounds()
         start.forward_chars(10)
         buffer.apply_tag(tag, start, end)
-        self.assertTrue(start.begins_tag())
+        self.assertTrue(starts_tag(start))
         self.assertTrue(end.ends_tag())
         self.assertTrue(start.toggles_tag())
         self.assertTrue(end.toggles_tag())
         start.backward_chars(1)
-        self.assertFalse(start.begins_tag())
+        self.assertFalse(starts_tag(start))
         self.assertFalse(start.ends_tag())
         self.assertFalse(start.toggles_tag())
 
@@ -1920,9 +1965,25 @@ class TestTextBuffer(unittest.TestCase):
         self.assertEqual(buffer.get_property('text'),
                          'first line\nsecond line\n')
 
+    def test_backward_find_char(self):
+        buffer = Gtk.TextBuffer()
+        buffer.set_text('abc')
+        end = buffer.get_iter_at_line(99)
+
+        values = []
+
+        def pred_func(ch, user_data):
+            values.append(ch)
+            return ch == u"a"
+
+        self.assertTrue(end.backward_find_char(pred_func))
+        self.assertEqual(values, [u"c", u"b", u"a"])
+
 
 @unittest.skipUnless(Gtk, 'Gtk not available')
 class TestContainer(unittest.TestCase):
+
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_child_set_property(self):
         box = Gtk.Box()
         child = Gtk.Button()
@@ -1934,6 +1995,7 @@ class TestContainer(unittest.TestCase):
         box.child_get_property(child, 'padding', value)
         self.assertEqual(value.get_int(), 42)
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_child_get_property_gvalue(self):
         box = Gtk.Box()
         child = Gtk.Button()
@@ -1943,6 +2005,7 @@ class TestContainer(unittest.TestCase):
         box.child_get_property(child, 'padding', value)
         self.assertEqual(value.get_int(), 42)
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_child_get_property_return_with_explicit_gvalue(self):
         box = Gtk.Box()
         child = Gtk.Button()
@@ -1952,6 +2015,7 @@ class TestContainer(unittest.TestCase):
         result = box.child_get_property(child, 'padding', value)
         self.assertEqual(result, 42)
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_child_get_property_return_with_implicit_gvalue(self):
         box = Gtk.Box()
         child = Gtk.Button()
@@ -1963,10 +2027,14 @@ class TestContainer(unittest.TestCase):
     def test_child_get_property_error(self):
         box = Gtk.Box()
         child = Gtk.Button()
-        box.pack_start(child, expand=False, fill=True, padding=42)
+        if Gtk._version == "4.0":
+            box.pack_start(child, expand=False, fill=True)
+        else:
+            box.pack_start(child, expand=False, fill=True, padding=42)
         with self.assertRaises(ValueError):
             box.child_get_property(child, 'not-a-valid-child-property')
 
+    @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
     def test_child_get_and_set(self):
         box = Gtk.Box()
         child = Gtk.Button()
@@ -1982,3 +2050,19 @@ class TestContainer(unittest.TestCase):
         self.assertEqual(expand, False)
         self.assertEqual(fill, False)
         self.assertEqual(padding, 21)
+
+    @unittest.skipIf(Gtk._version != "4.0", "only in gtk4")
+    def test_child_get_and_set_gtk4(self):
+        # padding got removed in gtk4
+        box = Gtk.Box()
+        child = Gtk.Button()
+        box.pack_start(child, expand=True, fill=True)
+
+        expand, fill = box.child_get(child, 'expand', 'fill')
+        self.assertEqual(expand, True)
+        self.assertEqual(fill, True)
+
+        box.child_set(child, expand=False, fill=False, pack_type=1)
+        expand, fill, pack_type = box.child_get(child, 'expand', 'fill', 'pack-type')
+        self.assertEqual(expand, False)
+        self.assertEqual(fill, False)
index 5177213..5c09a6a 100644 (file)
@@ -4,14 +4,9 @@
 import unittest
 
 try:
-    import gi
-    gi.require_version('Pango', '1.0')
-    gi.require_version('PangoCairo', '1.0')
     from gi.repository import Pango
     from gi.repository import PangoCairo
-    Pango
-    PangoCairo
-except (ValueError, ImportError):
+except ImportError:
     Pango = None
     PangoCairo = None
 
index 109fdb9..ce035cd 100644 (file)
@@ -1,12 +1,13 @@
 # coding=utf-8
 
+import os
 import gc
 import sys
 import struct
 import types
 import unittest
+import tempfile
 
-import gi
 from gi.repository import GObject
 from gi.repository.GObject import ParamFlags, GType, new
 from gi.repository.GObject import \
@@ -22,25 +23,11 @@ from gi.repository.GLib import \
 
 from gi.repository import Gio
 from gi.repository import GLib
-gi.require_version('GIMarshallingTests', '1.0')
 from gi.repository import GIMarshallingTests
+from gi.repository import Regress
 from gi import _propertyhelper as propertyhelper
 
-try:
-    gi.require_version('Regress', '1.0')
-    from gi.repository import Regress
-    has_regress = True
-except (ValueError, ImportError):
-    has_regress = False
-
-if sys.version_info < (3, 0):
-    TEST_UTF8 = "\xe2\x99\xa5"
-    UNICODE_UTF8 = unicode(TEST_UTF8, 'UTF-8')
-else:
-    TEST_UTF8 = "♥"
-    UNICODE_UTF8 = TEST_UTF8
-
-from compathelper import _long, _unicode
+from compathelper import _long
 from helper import capture_glib_warnings, capture_output
 
 
@@ -93,20 +80,19 @@ class PropertyObject(GObject.GObject):
         flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT)
 
 
-if has_regress:
-    class PropertyInheritanceObject(Regress.TestObj):
-        # override property from the base class, with a different type
-        string = GObject.Property(type=int)
+class PropertyInheritanceObject(Regress.TestObj):
+    # override property from the base class, with a different type
+    string = GObject.Property(type=int)
 
-        # a property entirely defined at the Python level
-        python_prop = GObject.Property(type=str)
+    # a property entirely defined at the Python level
+    python_prop = GObject.Property(type=str)
 
-    class PropertySubClassObject(PropertyInheritanceObject):
-        # override property from the base class, with a different type
-        python_prop = GObject.Property(type=int)
+
+class PropertySubClassObject(PropertyInheritanceObject):
+    # override property from the base class, with a different type
+    python_prop = GObject.Property(type=int)
 
 
-@unittest.skipUnless(has_regress, 'Missing Regress typelib')
 class TestPropertyInheritanceObject(unittest.TestCase):
     def test_override_gi_property(self):
         self.assertNotEqual(Regress.TestObj.props.string.value_type,
@@ -181,12 +167,14 @@ class TestPropertyObject(unittest.TestCase):
         self.assertEqual(obj.props.construct, "789")
 
     def test_utf8(self):
-        obj = new(PropertyObject, construct_only=UNICODE_UTF8)
-        self.assertEqual(obj.props.construct_only, TEST_UTF8)
-        obj.set_property('construct', UNICODE_UTF8)
-        self.assertEqual(obj.props.construct, TEST_UTF8)
-        obj.props.normal = UNICODE_UTF8
-        self.assertEqual(obj.props.normal, TEST_UTF8)
+        test_utf8 = "♥"
+        unicode_utf8 = u"♥"
+        obj = new(PropertyObject, construct_only=unicode_utf8)
+        self.assertEqual(obj.props.construct_only, test_utf8)
+        obj.set_property('construct', unicode_utf8)
+        self.assertEqual(obj.props.construct, test_utf8)
+        obj.props.normal = unicode_utf8
+        self.assertEqual(obj.props.normal, test_utf8)
 
     def test_int_to_str(self):
         obj = new(PropertyObject, construct_only=1)
@@ -417,10 +405,11 @@ class TestPropertyObject(unittest.TestCase):
     def test_interface(self):
         obj = new(PropertyObject)
 
-        file = Gio.File.new_for_path('/some/path')
+        path = os.path.join(tempfile.gettempdir(), "some", "path")
+        file = Gio.File.new_for_path(path)
         obj.props.interface = file
-        self.assertEqual(obj.props.interface.get_path(), '/some/path')
-        self.assertEqual(obj.interface.get_path(), '/some/path')
+        self.assertEqual(obj.props.interface.get_path(), path)
+        self.assertEqual(obj.interface.get_path(), path)
 
         self.assertRaises(TypeError, setattr, obj, 'interface', 'foo')
         self.assertRaises(TypeError, setattr, obj, 'interface', object())
@@ -766,7 +755,6 @@ class TestProperty(unittest.TestCase):
         b.prop1 = 20
         self.assertEqual(b.prop1, 20)
 
-    @unittest.skipUnless(has_regress, 'Missing regress typelib')
     def test_property_subclass_c(self):
         class A(Regress.TestSubObj):
             prop1 = GObject.Property(type=int)
@@ -970,6 +958,40 @@ class CPropertiesTestBase(object):
     def set_prop(self, obj, name, value):
         raise NotImplementedError
 
+    # https://bugzilla.gnome.org/show_bug.cgi?id=780652
+    @unittest.skipUnless(
+        "some_flags" in dir(GIMarshallingTests.PropertiesObject.props),
+        "tool old gi")
+    def test_flags(self):
+        self.assertEqual(
+            self.get_prop(self.obj, 'some-flags'),
+            GIMarshallingTests.Flags.VALUE1)
+        self.set_prop(self.obj, 'some-flags', GIMarshallingTests.Flags.VALUE2)
+        self.assertEqual(self.get_prop(self.obj, 'some-flags'),
+                         GIMarshallingTests.Flags.VALUE2)
+
+        obj = GIMarshallingTests.PropertiesObject(
+            some_flags=GIMarshallingTests.Flags.VALUE3)
+        self.assertEqual(self.get_prop(obj, 'some-flags'),
+                         GIMarshallingTests.Flags.VALUE3)
+
+    # https://bugzilla.gnome.org/show_bug.cgi?id=780652
+    @unittest.skipUnless(
+        "some_enum" in dir(GIMarshallingTests.PropertiesObject.props),
+        "tool old gi")
+    def test_enum(self):
+        self.assertEqual(
+            self.get_prop(self.obj, 'some-enum'),
+            GIMarshallingTests.GEnum.VALUE1)
+        self.set_prop(self.obj, 'some-enum', GIMarshallingTests.GEnum.VALUE2)
+        self.assertEqual(self.get_prop(self.obj, 'some-enum'),
+                         GIMarshallingTests.GEnum.VALUE2)
+
+        obj = GIMarshallingTests.PropertiesObject(
+            some_enum=GIMarshallingTests.GEnum.VALUE3)
+        self.assertEqual(self.get_prop(obj, 'some-enum'),
+                         GIMarshallingTests.GEnum.VALUE3)
+
     def test_boolean(self):
         self.assertEqual(self.get_prop(self.obj, 'some-boolean'), False)
         self.set_prop(self.obj, 'some-boolean', True)
@@ -1110,10 +1132,10 @@ class CPropertiesTestBase(object):
         self.assertEqual(self.get_prop(obj, 'some-strv'), ['hello', 'world'])
 
         # unicode on py2
-        obj = GIMarshallingTests.PropertiesObject(some_strv=[_unicode('foo')])
-        self.assertEqual(self.get_prop(obj, 'some-strv'), [_unicode('foo')])
+        obj = GIMarshallingTests.PropertiesObject(some_strv=[u'foo'])
+        self.assertEqual(self.get_prop(obj, 'some-strv'), [u'foo'])
         self.assertRaises(TypeError, self.set_prop, self.obj, 'some-strv',
-                          [_unicode('foo'), 1])
+                          [u'foo', 1])
 
     def test_boxed_struct(self):
         self.assertEqual(self.get_prop(self.obj, 'some-boxed-struct'), None)
@@ -1147,7 +1169,6 @@ class CPropertiesTestBase(object):
         self.assertRaises(TypeError, self.set_prop, self.obj, 'some-boxed-glist', 'foo')
         self.assertRaises(TypeError, self.set_prop, self.obj, 'some-boxed-glist', ['a'])
 
-    @unittest.skipUnless(has_regress, 'built without cairo support')
     def test_annotated_glist(self):
         obj = Regress.TestObj()
         self.assertEqual(self.get_prop(obj, 'list'), [])
@@ -1188,7 +1209,6 @@ class CPropertiesTestBase(object):
         self.assertEqual(42, self.get_prop(obj, 'some-int'))
         self.assertEqual(54, self.get_prop(obj, 'some-uchar'))
 
-    @unittest.skipUnless(has_regress, 'built without cairo support')
     def test_gtype(self):
         obj = Regress.TestObj()
         self.assertEqual(self.get_prop(obj, 'gtype'), GObject.TYPE_INVALID)
@@ -1200,7 +1220,6 @@ class CPropertiesTestBase(object):
         self.set_prop(obj, 'gtype', str)
         self.assertEqual(self.get_prop(obj, 'gtype'), GObject.TYPE_STRING)
 
-    @unittest.skipUnless(has_regress, 'built without cairo support')
     def test_hash_table(self):
         obj = Regress.TestObj()
         self.assertEqual(self.get_prop(obj, 'hash-table'), None)
@@ -1210,7 +1229,6 @@ class CPropertiesTestBase(object):
         self.assertEqual(list(self.get_prop(obj, 'hash-table').items())[0],
                          ('mec', 56))
 
-    @unittest.skipUnless(has_regress, 'built without cairo support')
     def test_parent_class(self):
         class A(Regress.TestObj):
             prop1 = GObject.Property(type=int)
index f59f86b..d7b6d2e 100644 (file)
 import unittest
 import collections
 
-import gi
-
-gi.require_version('GIRepository', '2.0')
-
 import gi._gi as GIRepository
 from gi.module import repository as repo
 from gi.repository import GObject
 from gi.repository import GIMarshallingTests
 from gi.repository import GIRepository as IntrospectedRepository
 
-try:
-    import cairo
-    cairo
-    has_cairo = True
-except ImportError:
-    has_cairo = False
-
 from helper import capture_glib_warnings
 
 
@@ -149,7 +138,6 @@ class Test(unittest.TestCase):
         self.assertEqual(GIRepository.RegisteredTypeInfo.get_type_init(info),
                          'gi_marshalling_tests_object_get_type')
 
-    @unittest.skipUnless(has_cairo, 'Regress needs cairo')
     def test_fundamental_object_info(self):
         repo.require('Regress')
         info = repo.find_by_name('Regress', 'TestFundamentalObject')
@@ -253,7 +241,6 @@ class Test(unittest.TestCase):
         self.assertEqual(func_info.get_return_type().get_tag(), GIRepository.TypeTag.VOID)
         self.assertRaises(AttributeError, func_info.get_return_attribute, '_not_an_attr')
 
-    @unittest.skipUnless(has_cairo, 'Regress needs cairo')
     def test_signal_info(self):
         repo.require('Regress')
         info = repo.find_by_name('Regress', 'TestObj')
@@ -270,7 +257,6 @@ class Test(unittest.TestCase):
         self.assertFalse(sig_info.true_stops_emit())
         self.assertEqual(sig_info.get_flags(), sig_flags)
 
-    @unittest.skipUnless(has_cairo, 'Regress needs cairo')
     def test_notify_signal_info_with_obj(self):
         repo.require('Regress')
         info = repo.find_by_name('Regress', 'TestObj')
index 91607f9..4e81c1e 100644 (file)
@@ -5,20 +5,12 @@ import unittest
 import sys
 import weakref
 
-from gi.repository import GObject, GLib
+from gi.repository import GObject, GLib, Regress
 from gi import _signalhelper as signalhelper
 import testhelper
 from compathelper import _long
 from helper import capture_glib_warnings, capture_gi_deprecation_warnings
 
-try:
-    import cairo
-    cairo  # PyFlakes
-    from gi.repository import Regress
-    has_cairo = True
-except ImportError:
-    has_cairo = False
-
 
 class C(GObject.GObject):
     __gsignals__ = {'my_signal': (GObject.SignalFlags.RUN_FIRST, None,
@@ -949,7 +941,6 @@ class TestConnectDataNonIntrospected(unittest.TestCase, _ConnectDataTestBase):
                                              flags=GObject.SignalFlags.RUN_LAST)
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestConnectDataIntrospected(unittest.TestCase, _ConnectDataTestBase):
     # This tests connect_data with introspected signals brought in from Regress.
     Object = Regress.TestObj
@@ -1089,7 +1080,6 @@ class TestSignalModuleLevelFunctions(unittest.TestCase):
                          None)
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestIntrospectedSignals(unittest.TestCase):
     def test_object_param_signal(self):
         obj = Regress.TestObj()
@@ -1315,7 +1305,6 @@ class TestConnectGObjectNonIntrospected(unittest.TestCase, _ConnectObjectTestBas
         pass
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestConnectGObjectIntrospected(unittest.TestCase, _ConnectObjectTestBase):
     # This tests connect_object with introspected signals brought in from Regress.
     Object = Regress.TestObj
@@ -1338,7 +1327,6 @@ class TestConnectPyObjectNonIntrospected(unittest.TestCase, _ConnectObjectTestBa
     SwapObject = object
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestConnectPyObjectIntrospected(unittest.TestCase, _ConnectObjectTestBase):
     # This tests connect_object with introspected signals brought in from Regress.
     Object = Regress.TestObj
@@ -1474,7 +1462,6 @@ class TestRefCountsNonIntrospected(unittest.TestCase, _RefCountTestBase):
                                              flags=GObject.SignalFlags.RUN_LAST)
 
 
-@unittest.skipUnless(has_cairo, 'built without cairo support')
 class TestRefCountsIntrospected(unittest.TestCase, _RefCountTestBase):
     Object = Regress.TestObj
 
index f13ab6b..866826e 100644 (file)
@@ -1,5 +1,6 @@
 # -*- Mode: Python -*-
 
+import sys
 import gc
 import unittest
 import warnings
@@ -191,6 +192,7 @@ class TestSource(unittest.TestCase):
         GLib.Timeout(20)
         GLib.Idle()
 
+    @unittest.skipIf(sys.platform == "darwin", "hangs")
     def test_finalize(self):
         self.dispatched = False
         self.finalized = False
@@ -281,6 +283,7 @@ class TestSource(unittest.TestCase):
         self.assertEqual(source.kwarg, 2)
 
 
+@unittest.skipIf(sys.platform == "darwin", "hangs")
 class TestUserData(unittest.TestCase):
     def test_idle_no_data(self):
         ml = GLib.MainLoop()
@@ -297,7 +300,7 @@ class TestUserData(unittest.TestCase):
 
         def cb():
             ml.quit()
-        id = GLib.timeout_add(50, cb)
+        id = GLib.timeout_add(1, cb)
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_DEFAULT)
         ml.run()
@@ -337,7 +340,7 @@ class TestUserData(unittest.TestCase):
             data['called'] = True
             ml.quit()
         data = {}
-        id = GLib.timeout_add(50, cb, data)
+        id = GLib.timeout_add(1, cb, data)
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_DEFAULT)
         ml.run()
@@ -351,7 +354,7 @@ class TestUserData(unittest.TestCase):
             data['data2'] = data2
             ml.quit()
         data = {}
-        id = GLib.timeout_add(50, cb, data, 'hello')
+        id = GLib.timeout_add(1, cb, data, 'hello')
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_DEFAULT)
         ml.run()
@@ -373,7 +376,7 @@ class TestUserData(unittest.TestCase):
 
         def cb():
             ml.quit()
-        id = GLib.timeout_add(50, cb, priority=GLib.PRIORITY_HIGH)
+        id = GLib.timeout_add(1, cb, priority=GLib.PRIORITY_HIGH)
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_HIGH)
         ml.run()
@@ -398,7 +401,7 @@ class TestUserData(unittest.TestCase):
             data['called'] = True
             ml.quit()
         data = {}
-        id = GLib.timeout_add(50, cb, data, priority=GLib.PRIORITY_HIGH)
+        id = GLib.timeout_add(1, cb, data, priority=GLib.PRIORITY_HIGH)
         self.assertEqual(ml.get_context().find_source_by_id(id).priority,
                          GLib.PRIORITY_HIGH)
         ml.run()
index fac54c9..deea58f 100644 (file)
@@ -9,6 +9,7 @@ from gi.repository import GLib
 from gi import PyGIDeprecationWarning
 
 
+@unittest.skipIf(os.name == "nt", "not on Windows")
 class TestProcess(unittest.TestCase):
 
     def test_deprecated_child_watch_no_data(self):
index 3d0557e..3da3310 100644 (file)
@@ -9,11 +9,14 @@ from gi.repository import GLib
 class TestThread(unittest.TestCase):
     def setUp(self):
         self.main = GLib.MainLoop()
+        self.called = False
 
     def from_thread_cb(self, test, enum):
         assert test == self.obj
         assert int(enum) == 0
         assert type(enum) != int
+        self.called = True
+        GLib.idle_add(self.timeout_cb)
 
     def idle_cb(self):
         self.obj = testhelper.get_test_thread()
@@ -22,8 +25,9 @@ class TestThread(unittest.TestCase):
 
     def test_extension_module(self):
         GLib.idle_add(self.idle_cb)
-        GLib.timeout_add(50, self.timeout_cb)
+        GLib.timeout_add(2000, self.timeout_cb)
         self.main.run()
+        self.assertTrue(self.called)
 
     def timeout_cb(self):
         self.main.quit()
index 66c0155..343b14f 100644 (file)
@@ -147,12 +147,12 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
     PyObject *py_args;
     PyObject *py_method;
     
-    __py_state = pyg_gil_state_ensure();
+    __py_state = PyGILState_Ensure();
     py_self = pygobject_new((GObject *) self);
     if (!py_self) {
         if (PyErr_Occurred())
             PyErr_Print();
-        pyg_gil_state_release(__py_state);
+        PyGILState_Release(__py_state);
         return;
     }
     py_args = PyTuple_New(0);
@@ -162,7 +162,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
             PyErr_Print();
         Py_DECREF(py_args);
         Py_DECREF(py_self);
-        pyg_gil_state_release(__py_state);
+        PyGILState_Release(__py_state);
         return;
     }
     py_retval = PyObject_CallObject(py_method, py_args);
@@ -172,7 +172,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
         Py_DECREF(py_method);
         Py_DECREF(py_args);
         Py_DECREF(py_self);
-        pyg_gil_state_release(__py_state);
+        PyGILState_Release(__py_state);
         return;
     }
     if (py_retval != Py_None) {
@@ -183,7 +183,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
         Py_DECREF(py_method);
         Py_DECREF(py_args);
         Py_DECREF(py_self);
-        pyg_gil_state_release(__py_state);
+        PyGILState_Release(__py_state);
         return;
     }
     
@@ -191,7 +191,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
     Py_DECREF(py_method);
     Py_DECREF(py_args);
     Py_DECREF(py_self);
-    pyg_gil_state_release(__py_state);
+    PyGILState_Release(__py_state);
 }
 
 static void
@@ -612,9 +612,13 @@ static PyMethodDef testhelper_functions[] = {
 
 PYGLIB_MODULE_START(testhelper, "testhelper")
 {
+  PyObject *gobject_module;
   PyObject *m, *d;
-  
-  pygobject_init(-1, -1, -1);
+
+
+  if ((gobject_module = pygobject_init(-1, -1, -1)) == NULL)
+    return NULL;
+  Py_DECREF (gobject_module);
 
   d = PyModule_GetDict(module);