diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:50:11 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:50:14 +0900 |
commit | 321841ba84f12124d94039cd8bbf60b3d342f6e3 (patch) | |
tree | 7c15db86760a48a4e8eb11380e81600425a01e25 | |
parent | 2d8c9073fa23a0fde76a3b8ecf8cb518d162d101 (diff) | |
download | pygobject2-321841ba84f12124d94039cd8bbf60b3d342f6e3.tar.gz pygobject2-321841ba84f12124d94039cd8bbf60b3d342f6e3.tar.bz2 pygobject2-321841ba84f12124d94039cd8bbf60b3d342f6e3.zip |
Imported Upstream version 3.9.5
Change-Id: I5c00e3743d666bd221bb85dff935baa1a9838070
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
60 files changed, 5111 insertions, 3915 deletions
@@ -1,3 +1,866 @@ +commit 2d8f5490cdc078b3e56a92deb9eca71b3fc5ef17 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Jul 29 02:23:02 2013 -0700 + + release 3.9.5 + + NEWS | 41 +++++++++++++++++++++++++++++++++++++++++ + configure.ac | 2 +- + 2 files changed, 42 insertions(+), 1 deletion(-) + +commit ec3de7608ec970f6f272c9d7937344f02c6e9c3d +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Jul 29 01:21:19 2013 -0700 + + Ensure exceptions set in closure out argument marshaling are printed + + Call PyErr_Print when an exception occurs after marshaling closure + out arguments. These exceptions were being ignored and cleared out + only to show up in debug builds of Python. + + https://bugzilla.gnome.org/show_bug.cgi?id=705064 + + gi/pygi-closure.c | 8 ++++++++ + tests/test_generictreemodel.py | 17 +++++++++++------ + 2 files changed, 19 insertions(+), 6 deletions(-) + +commit b5dcb1800839f747a052e487643c234668384677 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sun Jul 28 23:00:26 2013 -0700 + + Use Python error messages for marshaling integers from Python + + Use Pythons default error messages where possible. + Change all explicitly raised ValueError to use OverflowError + for out of range data. + + https://bugzilla.gnome.org/show_bug.cgi?id=705057 + + gi/pygi-marshal-from-py.c | 76 + +++++++++++++++++------------------------------ + tests/test_everything.py | 52 ++++++++++++++++---------------- + tests/test_gi.py | 64 +++++++++++++++++++-------------------- + tests/test_gobject.py | 2 +- + 4 files changed, 86 insertions(+), 108 deletions(-) + +commit 3c83bfb14b850670eb7c0208e55c120ca203f8af +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 27 21:10:07 2013 -0700 + + Use Py_CLEAR for closure cleanup instead of test with Py_DECREF + + gi/pygi-closure.c | 11 ++--------- + 1 file changed, 2 insertions(+), 9 deletions(-) + +commit f5e3876dee512ca82af6ea798b10d5ecad785dd1 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 27 15:25:20 2013 -0700 + + Cleanup invoke args and kwargs combiner code + + Change _py_args_combine_and_check_length use cleaner reference + counting. + It no longer DECREFs input arguments and always returns a new value + reference. + Use PyGICallableCache directly as an argument instead of passing + various + members. + + gi/pygi-invoke.c | 44 +++++++++++++++++--------------------------- + 1 file changed, 17 insertions(+), 27 deletions(-) + +commit 91c49822363d8a1efc82163b46daa667d6cfc1b7 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Wed Jul 17 16:10:25 2013 -0700 + + Replace Python VFunc descriptor directly with PyGIVFuncInfo + + Add tp_getdesc (__get__) to PyGIVFuncInfo to allow the object + to be used directly as a callable descriptor. This piggy backs + off the added support for functions and constructors in previous + patches. + + https://bugzilla.gnome.org/show_bug.cgi?id=704037 + + gi/pygi-info.c | 25 +++++++++++++++++++++++-- + gi/types.py | 33 ++++----------------------------- + 2 files changed, 27 insertions(+), 31 deletions(-) + +commit 35f79b22ec5abf02fd0bb66352eb1f251b65a078 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 16 16:00:14 2013 -0700 + + Add callable and descriptor protocols to PyGICallableInfo + + Add tp_call (__call__) function to callable info objects. + This allows for replacement of wrapped invoke methods directly + with the already created callable info object. This has the + additional side effect of making doc strings lazily bound + (only generated when __doc__ is accessed). + + Add tp_desc_get (__get__) to PyGIFunctionInfo which returns + a bound version of itself for methods and constructors. + + Update various internal type checks to reflect the changes. + Update tests to reflect the new callable type being the same + across Python 2 & 3. + + This patch gives roughly a %17 speedup for Gtk imports and + an %11 speedup for GI method calls. + + https://bugzilla.gnome.org/show_bug.cgi?id=704037 + + gi/module.py | 5 +- + gi/overrides/__init__.py | 10 ++- + gi/pygi-info.c | 179 + ++++++++++++++++++++++++++++++++++++++++++-- + gi/pygi.h | 13 ++++ + gi/types.py | 35 +-------- + tests/test_docstring.py | 6 +- + tests/test_gi.py | 32 +++----- + tests/test_overrides_gtk.py | 4 +- + 8 files changed, 212 insertions(+), 72 deletions(-) + +commit 2339e030e4dc4d93ea770bca380a89f831d56be6 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Fri Jul 26 19:33:32 2013 -0700 + + Move "from Python" GObject out arg marshaler into specialized function + + Move hacks specific to out argument marshaling for vfuncs into a + a specialized function. This allows standard function call marshaling + to continue working correctly when there are no extra references + holding the arguments "foo(SomeObject())". This is currently being + masked because all GI functions are wrapped by additional layers + of Python functions. When these layers are removed, it exposes + bugs introduced by reference counting hacks intended for vfunc + return arguments. + + https://bugzilla.gnome.org/show_bug.cgi?id=704037 + + gi/pygi-argument.c | 2 +- + gi/pygi-marshal-from-py.c | 37 ++++++++++++++++++++++++++++++------- + gi/pygi-marshal-from-py.h | 3 +++ + 3 files changed, 34 insertions(+), 8 deletions(-) + +commit 627c5faaa54ed9a2b59ac1547833c171cd1a1e87 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Fri Jul 26 17:34:01 2013 -0700 + + Add underscore prefix and _cache_adapter suffix to marshaling + functions + + Add underscores to all _pygi_marshal_* functions. We don't currently + export symbols, but we might need to for C unittesting. This will + ensure we don't have a "public API". + Add _cache_adapter suffix to marshaling functions which are light + weight wrappers intended only for cached marshalers. + + gi/pygi-argument.c | 40 +++++++++++----------- + gi/pygi-cache.c | 10 +++--- + gi/pygi-marshal-from-py.c | 86 + +++++++++++++++++++++++------------------------ + gi/pygi-marshal-from-py.h | 44 ++++++++++++------------ + gi/pygi-marshal-to-py.c | 48 +++++++++++++------------- + gi/pygi-marshal-to-py.h | 34 +++++++++---------- + 6 files changed, 131 insertions(+), 131 deletions(-) + +commit bec0b543be8d993996d8a17c343c3f2f33a9398f +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 16 11:13:17 2013 -0700 + + Add common attribute accessors to PyGIBaseInfo + + Add __name__, __module__, and __doc__ accessors to + PyGIBaseInfo object. This is a precursory patch for setting + up PyGICallableInfo as a directly callable object with lazy + doc string evaluation. + + https://bugzilla.gnome.org/show_bug.cgi?id=704037 + + gi/_glib/pyglib-python-compat.h | 5 +++ + gi/pygi-info.c | 83 + +++++++++++++++++++++++++++++++++++++++-- + gi/types.py | 7 ++-- + 3 files changed, 88 insertions(+), 7 deletions(-) + +commit ea194404843a16555f9a475cc973872a4428bfe1 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 13 23:10:31 2013 -0700 + + Merge method and constructor setup + + Merge _setup_constructors into _setup_methods as they contain same + basic logic. This removes an unnecessary call with additional + filtering of GIObjectInfo.get_methods() which can be large for + objects with many methods. + + https://bugzilla.gnome.org/show_bug.cgi?id=704037 + + gi/types.py | 15 ++++----------- + 1 file changed, 4 insertions(+), 11 deletions(-) + +commit 6b36fbe904d19f515578f447daa7657d3a9a859c +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 13 18:11:18 2013 -0700 + + Remove redundant info.get_name calls + + Remove a number of redundant calls to GIBaseInfo.get_name. Info + names are already cached on function objects so re-use them when + possible. This gives a small load time improvement by removing over + 2000 calls when importing Gtk. + + https://bugzilla.gnome.org/show_bug.cgi?id=704037 + + gi/module.py | 1 - + gi/types.py | 8 +++----- + 2 files changed, 3 insertions(+), 6 deletions(-) + +commit 6fdde256e840600c84a648ab21da2fe5c212e5bc +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Fri Jul 12 12:21:54 2013 -0700 + + Move doc string generator into separate module + + Move the doc string generator for creating function signatures + into "gi.docstring". This includes a new API for getting and + setting the doc string creation functions: + + gi.docstring.get_doc_string_generator + gi.docstring.set_doc_string_generator + gi.docstring.generate_doc_string + + Beyond adding the ability for custom doc string generators, + this API is a necessary step for adding lazy __doc__ + attribute access for optimization. + + https://bugzilla.gnome.org/show_bug.cgi?id=704037 + + gi/Makefile.am | 3 +- + gi/docstring.py | 106 + ++++++++++++++++++++++++++++++++++++++++++++++++ + gi/types.py | 55 ++----------------------- + tests/Makefile.am | 1 + + tests/test_docstring.py | 49 ++++++++++++++++++++++ + tests/test_gi.py | 30 -------------- + 6 files changed, 161 insertions(+), 83 deletions(-) + +commit f86701b15ee04c717d9c6bf688101606165e4f83 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Wed Jul 24 19:36:28 2013 -0700 + + tests: Change GHashTable<string,GValue> marshaling test to use GValue + + Add test to explicitly use a boxed GStrv GValue in addition to a + Python list sub-class. + + https://bugzilla.gnome.org/show_bug.cgi?id=666636 + + tests/test_everything.py | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +commit 6ea41b60691e1ba7e21374582d7aea072af71103 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Thu Jul 25 18:00:47 2013 -0700 + + gtk-demo: Change demo to use Gtk.Application + + Replace deriving from Gtk.Window with deriving from Gtk.Application + connected to a Gtk.ApplicationWindow instance. + + https://bugzilla.gnome.org/show_bug.cgi?id=698547 + + demos/gtk-demo/demos/printing.py | 2 +- + demos/gtk-demo/gtk-demo.py | 40 + ++++++++++++++++++++-------------------- + 2 files changed, 21 insertions(+), 21 deletions(-) + +commit fae58044ea0b2e7f47fbdacc5b58ac36f673ecbd +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 23 14:25:01 2013 -0700 + + Move _pygi_argument_to_object_basic_type into pygi-marshal-to-py.c + + Move _pygi_argument_to_object_basic_type into pygi-marshal-to-py.c + and rename to _pygi_marshal_to_py_basic_type. + Cleanup and simplify dependant sub-marshalers for unichar, utf8, + and filename types. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-argument.c | 73 +----------------------------- + gi/pygi-argument.h | 4 -- + gi/pygi-cache.c | 4 +- + gi/pygi-marshal-to-py.c | 115 + +++++++++++++++++++++++++++++++++++++----------- + gi/pygi-marshal-to-py.h | 27 +++--------- + 5 files changed, 99 insertions(+), 124 deletions(-) + +commit cba401ac1543c2fdb68fff0dba8f6da7eed23bfa +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 23 13:06:33 2013 -0700 + + Unify and clean up from Python marshalers for basic types + + Unify and cleanup boolean, float, double, gtype, unichar, utf8, + and filename marshalers. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-cache.c | 101 + ++-------------------------------------------- + gi/pygi-marshal-from-py.c | 86 ++++++++++++--------------------------- + gi/pygi-marshal-from-py.h | 30 -------------- + 3 files changed, 28 insertions(+), 189 deletions(-) + +commit 9e6e01d065bf0acc5b99ae0e8c034d689231bfe1 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 23 12:35:06 2013 -0700 + + Unify from Python int64 and uint64 marshalers + + Replaced int64 and uint64 cached marshalers with usage of the + unified basic type marshaler. Replace a large amount of int64 + exception formatting code with usage of %S for Python 3 and + give a more vague message for Python 2. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-cache.c | 36 +-------- + gi/pygi-marshal-from-py.c | 193 + ++++++++++------------------------------------ + gi/pygi-marshal-from-py.h | 10 --- + 3 files changed, 43 insertions(+), 196 deletions(-) + +commit 46653922003c7d1d5d16f5cdb39b3faadf9aff27 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 23 11:03:14 2013 -0700 + + Unify from Python int16 and int32 marshalers + + Add PyNumber_Check to unified basic type marshaler. + Add bounds checking to unified int16 and int32 marshalers. + Replaced int16 and int32 cached marshalers with usage of + unified basic type marshaler. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-cache.c | 69 +-------------- + gi/pygi-marshal-from-py.c | 218 + ++++++++++------------------------------------ + gi/pygi-marshal-from-py.h | 20 ----- + 3 files changed, 48 insertions(+), 259 deletions(-) + +commit 4b9c725a615fcf4a5e8d089d275d4586032d0d1f +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 23 00:27:14 2013 -0700 + + Unify from Python boolean, int8, and uint8 marshalers + + Replaced boolean, int8, and uint8 cached marshalers with usage of + unified basic type marshaler. Add bounds checking to unified int8 + marshalers. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-cache.c | 48 +++------------ + gi/pygi-marshal-from-py.c | 146 + +++++++++++----------------------------------- + gi/pygi-marshal-from-py.h | 20 ++----- + 3 files changed, 45 insertions(+), 169 deletions(-) + +commit f517bfbc134b78a23b754332e59b9bb67bb68e98 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Jul 22 23:24:13 2013 -0700 + + Add support for PyBytes with int8 and uint8 from Python marshaler + + This additional type marshaling is necessary for unifying marhalers + due to the same feature being available with cached argument + marshaling. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-marshal-from-py.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +commit fe9df90531f3dd04c0d13d73ebd4ae7dd396c9b1 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Jul 22 23:23:29 2013 -0700 + + Move from Python integer marshaling into separate function + + Add _pygi_marshal_from_py_long for marshaling Python objects + that can convert to a PyLong type. This allows for better + sharing of code amongst marshalers along with unifying + them across Python 2.7 and 3.0. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-argument.c | 3 +- + gi/pygi-marshal-from-py.c | 159 + ++++++++++++++++++++++++---------------------- + 2 files changed, 84 insertions(+), 78 deletions(-) + +commit f7748affae3d6ef0cc2e409f65761fb29c01b038 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Mon Jul 22 22:19:26 2013 -0700 + + Move _pygi_argument_from_object_basic_type into pygi-marshal-from-py.c + + Move _pygi_argument_from_object_basic_type into pygi-marshal-from-py.c + and rename to: _pygi_marshal_from_py_basic_type + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-argument.c | 149 + +--------------------------------------------- + gi/pygi-marshal-from-py.c | 147 + +++++++++++++++++++++++++++++++++++++++++++++ + gi/pygi-marshal-from-py.h | 4 ++ + 3 files changed, 152 insertions(+), 148 deletions(-) + +commit 9c9510eec782f242280af24e86adf3561e4fac72 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Fri Jul 19 23:37:35 2013 -0700 + + Move basic type marshaling out of _pygi_argument_from_object + + Move the marshaling of Python objects to GI arguments for basic types + into a new function: _pygi_argument_from_object_basic_type + This is staging work needed before unifying basic type marshaling + of arguments from Python to GI. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-argument.c | 73 + ++++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 46 insertions(+), 27 deletions(-) + +commit 0e2441518ef31bd2b4102ba5780c3ded00bec59a +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Fri Jul 19 20:16:10 2013 -0700 + + Replace to Python cached marshalers with unified basic type marshaler + + Add cached arg marshaler "_pygi_marshal_to_py_basic_type" which + unifies functions, vfuncs, signals, and property marshaling for + "basic types". Remove all the individual cached arg marshalers + for these types. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-argument.c | 104 +++++++++++------------------------ + gi/pygi-argument.h | 4 ++ + gi/pygi-cache.c | 114 +++++++------------------------------- + gi/pygi-marshal-to-py.c | 142 + ++++-------------------------------------------- + gi/pygi-marshal-to-py.h | 48 ++-------------- + 5 files changed, 73 insertions(+), 339 deletions(-) + +commit 663fe5893bbc9f34bf8aa4da3cb6f9186a8233b1 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Fri Jul 19 18:00:40 2013 -0700 + + Move to Python basic type marshaling out of _pygi_argument_to_object + + Move the marshaling of GI arguments to Python objects for basic types + into a new function. The required information for this marshaler + is a GITypeTag and GITransfer. Argument marshaling matching these + requirments are now found in: _pygi_argument_to_object_basic_type. + The new marshaler can be used with a generic argument cache marshaler + to unify all of the "basic type" marshaling. + + https://bugzilla.gnome.org/show_bug.cgi?id=693405 + + gi/pygi-argument.c | 86 + +++++++++++++++++++++++++++++++++++++++--------------- + 1 file changed, 63 insertions(+), 23 deletions(-) + +commit dd43a1e19440dbe025451d2e4e07a6074086498d +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 6 14:16:36 2013 -0700 + + Override GValue.set/get_boxed with static C marshaler + + Override boxed type get/set methods on GValue to use the static C + GValue marshaler. This works around the inability of the introspection + version of these methods to know what the held GValue type is. + With this, all boxed types will now marshal properly with GValues as + their storage. + + https://bugzilla.gnome.org/show_bug.cgi?id=688081 + + gi/_gobject/gobjectmodule.c | 38 ++++++++++++++++++++++++++++++++++++++ + gi/overrides/GObject.py | 9 +++++++++ + 2 files changed, 47 insertions(+) + +commit 2cff4827e6d15bcad630316a8a4e67968a70bbbf +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 6 14:10:20 2013 -0700 + + Refactor pyg_value_from_pyobject into two functions + + Break pyg_value_from_pyobject into two functions. One which keeps + Python exceptions queued (pyg_value_from_pyobject_with_error) and + one which clears them (pyg_value_from_pyobject). This allows for + re-use for code which want to keep the errors around + + https://bugzilla.gnome.org/show_bug.cgi?id=688081 + + gi/_gobject/gobjectmodule.c | 4 ++- + gi/_gobject/pygobject-private.h | 1 + + gi/_gobject/pygobject.h | 2 ++ + gi/_gobject/pygtype.c | 67 + ++++++++++++++++++++++++++++++++--------- + 4 files changed, 59 insertions(+), 15 deletions(-) + +commit 84e91a9da3522d042faca65fd2ada1ccaee60153 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 6 20:41:19 2013 -0700 + + Fix indentation for pyg_value_from_pyobject + + https://bugzilla.gnome.org/show_bug.cgi?id=688081 + + gi/_gobject/pygtype.c | 744 + +++++++++++++++++++++++++------------------------- + 1 file changed, 372 insertions(+), 372 deletions(-) + +commit 6a29d9be14ec33d06816ade67a5ccf5c7a1cf398 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 6 13:32:39 2013 -0700 + + Add deprecation warning for marshaling arbitrary objects as pointers + + Add deprecation warning for marshaling arbitrary objects to/from void + pointers with the exception of integers, PyCapsules, and None. + + https://bugzilla.gnome.org/show_bug.cgi?id=688081 + + gi/pygi-marshal-from-py.c | 17 ++++++++++++++++- + gi/pygi-marshal-to-py.c | 10 ++++++++-- + 2 files changed, 24 insertions(+), 3 deletions(-) + +commit 077aefed8566adcb99d7570f52fe09c74c2098e5 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 6 13:34:53 2013 -0700 + + Move PyGIDeprecationWarning to C for shared Python/C usage + + https://bugzilla.gnome.org/show_bug.cgi?id=688081 + + gi/__init__.py | 19 ++++--------------- + gi/gimodule.c | 18 ++++++++++++++++++ + gi/pygi.h | 2 ++ + 3 files changed, 24 insertions(+), 15 deletions(-) + +commit 90427107af36ea3c624b36967ee181ed13b9828f +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Thu Jul 18 14:59:55 2013 -0700 + + Replace usage of __import__ with importlib.import_module + + https://bugzilla.gnome.org/show_bug.cgi?id=682320 + + gi/module.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +commit 6391a8e4f03d4010c0d7de79fc83138fd69e0e33 +Author: Mike Gorse <mgorse@suse.com> +Date: Wed Jul 10 16:44:23 2013 -0500 + + Always unref the GiTypeInfo when generating an argument cache + + We were leaking a GiTypeInfo when handling child arguments. + + https://bugzilla.gnome.org/show_bug.cgi?id=703973 + + gi/pygi-cache.c | 1 + + 1 file changed, 1 insertion(+) + +commit ce0ad7066ebdb7018fdce58dc32bbaa715206a0c +Author: Mike Gorse <mgorse@suse.com> +Date: Wed Jul 10 12:10:16 2013 -0500 + + Unref interface info when fetching enums or flags + + When calling g_type_info_get_interface, the resulting interface should + be dereferenced by calling g_base_info_unref. + + https://bugzilla.gnome.org/show_bug.cgi?id=703960 + + gi/pygi-marshal-from-py.c | 8 +++++++- + gi/pygi-marshal-to-py.c | 3 +++ + 2 files changed, 10 insertions(+), 1 deletion(-) + +commit a93755ddba9a1761b627583d7b9be63783c2c063 +Author: Daniel Drake <dsd@laptop.org> +Date: Tue Jul 9 13:03:36 2013 -0600 + + Speed up MRO calculation + + Optimize gi.type.mro() with the following observations and tricks: + + 1. Python prepares all the base classes before trying to calculate the + MRO of the current one (it first needs to populate __bases__, for + example). So we can assume that the base class MRO is already + available + in __mro__ and this will have been previously calculated (by us, + in the + case of gi classes). This avoids repeating a lot of MRO-calculating + work, + and also avoids (re)calculating MROs for inheritance chains + that don't + have any gi classes in them anyway. + + 2. With that simplification in place, we can avoid recursion, which + is not + all that great in Python... + + 3. ...except in the uncommon case of a Python2 old-style classes, + where + __mro__ is not available. There doesn't seem to be any existing + function to calculate or read MRO of old-style python classes, + so just + keep doing as before: calculate the C3 MRO of the old-style + class via + recursion. That behaviour is not really correct, and the + recursion is + not desirable, so we print a warning here. + + This makes the "hello world" Sugar app start up approximately + 0.5 seconds + faster on XO-1.5. + + https://bugzilla.gnome.org/show_bug.cgi?id=703829 + + gi/types.py | 30 +++++++++++++++++++++++++++--- + tests/test_gi.py | 16 ++++++++++++---- + 2 files changed, 39 insertions(+), 7 deletions(-) + +commit 7aca95781fc76f3e820e63325ccc07d128a60075 +Author: Daniel Drake <dsd@laptop.org> +Date: Wed Jul 10 10:45:47 2013 -0600 + + tests: Add tests for MRO override + + Add tests for the MRO override to prevent against unintended + behaviour changes. + + https://bugzilla.gnome.org/show_bug.cgi?id=703829 + + tests/test_gi.py | 66 + ++++++++++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 50 insertions(+), 16 deletions(-) + +commit a15333a36e31b76ea6b80251553840269ec5deb1 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 6 13:34:13 2013 -0700 + + Add GIL safety to pyobject_copy for copying boxed PyObjects + + https://bugzilla.gnome.org/show_bug.cgi?id=688081 + + gi/_gobject/pygobject.c | 3 +++ + 1 file changed, 3 insertions(+) + +commit 097c116d43a21bebf8e4bccde9cacc551db1e1e5 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Sat Jul 6 09:48:35 2013 -0700 + + testhelper: Fix import requirement for GObject + + Replace the importing of gi._gobject._gobject with + gi.repository.GObject + in tests/testhelpermodule.c + + The testhelper module was only importing the static bindings + (gi._gobject._gobject) and not the overrides (gi.repository.GObject). + This was causing some tests to fail when test_thread was the first + test to run in the suite due to it registering new types based on + PyGObject_Type. + + https://bugzilla.gnome.org/show_bug.cgi?id=703647 + + tests/testhelpermodule.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 0f6c571755e65b5e77d3d84e4516ef90d8ce0162 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Wed Jul 3 05:26:12 2013 -0700 + + Add marshalling of GI_TYPE_TAG_VOID held in a GValue to int + + Replace assertion for this case with a simple marshalling of the + pointer value to a Python int. While not particularly useful + this allows some callbacks in WebKit to function without causing + a segfault. + + https://bugzilla.gnome.org/show_bug.cgi?id=694233 + + gi/pygi-argument.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit e0084e7e73845fa2a2da29017d3622f361f11dfb +Author: Cole Robinson <crobinso@redhat.com> +Date: Sat Feb 16 17:26:43 2013 -0500 + + GTK overrides: Make connect_signals handle tuple + + This is used for passing extra arguments to callbacks during + signal emission in the form of: + builder.connect_signals({'on_clicked': (on_clicked, arg1, arg2)}) + + Co-Authored-By: Simon Feltman <sfeltman@src.gnome.org> + + https://bugzilla.gnome.org/show_bug.cgi?id=693994 + + gi/overrides/Gtk.py | 51 ++++++++---- + tests/test_overrides_gtk.py | 196 + +++++++++++++++++++++++++++++--------------- + 2 files changed, 165 insertions(+), 82 deletions(-) + +commit 466567373289e6f141709f08efa80ba588d3d64a +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 2 18:06:01 2013 -0700 + + Re-add support for passing GValue's by reference + + Fix special casing when marshaling from a Python held GValue + to a GValue argument intended for a function call. + The re-factoring of GValue marshaling in commit #9e47afe459df942d9f + broke this by always making a copy of the GValue. This removed the + ability to retrieve values with functions like + gtk_style_context_get_style_property. + + https://bugzilla.gnome.org/show_bug.cgi?id=701058 + + gi/pygi-argument.c | 2 +- + gi/pygi-marshal-from-py.c | 32 +++++++++++++++----------------- + 2 files changed, 16 insertions(+), 18 deletions(-) + +commit 40a3cd18fd7111ae177f6ab716f78d131f59a1c0 +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 2 19:20:04 2013 -0700 + + tests: Add test for pass-by-reference GValue + + https://bugzilla.gnome.org/show_bug.cgi?id=701058 + + tests/test_gi.py | 7 +++++++ + 1 file changed, 7 insertions(+) + +commit 3b3251593ea107f06b160234b0ca5393cb39ac1b +Author: Simon Feltman <sfeltman@src.gnome.org> +Date: Tue Jul 2 23:02:17 2013 -0700 + + Clear return value of closures to zero when an exception occures + + For return types other than void, set the ffi closure return argument + to 0 when a Python exception occures. This a good default in general + but also has the side affect of fixing failing idle callbacks + by causing them to be removed from main loops (after their stack + is printed). + + https://bugzilla.gnome.org/show_bug.cgi?id=702552 + + gi/pygi-closure.c | 14 ++++++++++++++ + tests/test_gi.py | 8 ++++++++ + 2 files changed, 22 insertions(+) + +commit ae3439f1d22482d6a920a869d3d17e7054af6f80 +Author: Martin Pitt <martinpitt@gnome.org> +Date: Wed Jul 3 10:40:28 2013 +0200 + + Don't use doctest syntax in docstrings for examples + + These are not actual doctests, so don't use the >>> syntax there. Just + indent + them. + + This fixes pyflakes 0.7 failures. + + https://bugzilla.gnome.org/show_bug.cgi?id=701009 + + gi/_gobject/propertyhelper.py | 11 +++++------ + gi/overrides/GObject.py | 8 ++++---- + gi/overrides/Gtk.py | 2 +- + 3 files changed, 10 insertions(+), 11 deletions(-) + +commit b96a6dc968566d339a2dfd7dd631ae52d812302a +Author: Garrett Regier <garrettregier@gmail.com> +Date: Tue Jul 2 06:07:15 2013 -0700 + + Add support for properties of type GInterface + + Add support for G_TYPE_INTERFACE/GInterface to switch + statement which handles G_TYPE_OBJECT based properties. + + Signed-off-by: Simon Feltman <sfeltman@src.gnome.org> + + https://bugzilla.gnome.org/show_bug.cgi?id=703456 + + gi/_gobject/gobjectmodule.c | 1 + + gi/_gobject/propertyhelper.py | 3 ++- + tests/test_properties.py | 16 ++++++++++++++++ + 3 files changed, 19 insertions(+), 1 deletion(-) + +commit 61b268e44af63d6d78feae42578bf75aa5cfd511 +Author: Martin Pitt <martinpitt@gnome.org> +Date: Fri Jun 21 07:27:48 2013 +0200 + + pygtkcompat: Fix for missing methods on Windows + + Deal with non-existing Gtk.Clipboard.get() and + GdkPixbuf.Pixbuf.new_from_file_at_scale() methods. + + https://bugzilla.gnome.org/show_bug.cgi?id=702787 + + pygtkcompat/pygtkcompat.py | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +commit 5e3ab0bb974cc785659666b871d795730b4f06b3 +Author: Chun-wei Fan <fanchunwei@src.gnome.org> +Date: Fri Jun 21 12:32:33 2013 +0800 + + gi/pygi-info.c: Avoid C99-style variable declaration + + https://bugzilla.gnome.org/show_bug.cgi?id=702786 + + gi/pygi-info.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 94167e12c118c85cd3172f9f5824fe53e55bcc2d +Author: Martin Pitt <martinpitt@gnome.org> +Date: Wed May 29 11:20:35 2013 +0200 + + GLib overrides: fix typo in deprecation message + + Spotted by Dmitrijs Ledkovs, thanks! + + gi/overrides/GLib.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 86569b69ade0fe157fa87365e9369dde84cd5c90 +Author: Martin Pitt <martinpitt@gnome.org> +Date: Tue May 28 17:57:20 2013 +0200 + + configure.ac: post-release version bump to 3.9.3 + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 10f703189ed6a7104252907d1b1a114f26d79559 +Author: Martin Pitt <martinpitt@gnome.org> +Date: Tue May 28 17:56:07 2013 +0200 + + release 3.9.2 + + NEWS | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + commit af8d048442b924c72a1d0ae868ee63ccf292759d Author: Martin Pitt <martinpitt@gnome.org> Date: Fri May 24 13:03:07 2013 +0200 diff --git a/Makefile.in b/Makefile.in index d248fc3..ac8756a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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. @@ -17,23 +16,51 @@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + 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@ @@ -53,13 +80,13 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/PKG-INFO.in \ - $(srcdir)/config.h.in \ +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/configure $(am__configure_deps) \ + $(srcdir)/config.h.in $(srcdir)/pygobject-3.0.pc.in \ $(srcdir)/pygobject-3.0-uninstalled.pc.in \ - $(srcdir)/pygobject-3.0.pc.in $(top_srcdir)/configure AUTHORS \ - COPYING ChangeLog INSTALL NEWS compile config.guess config.sub \ - depcomp install-sh ltmain.sh missing py-compile + $(srcdir)/PKG-INFO.in AUTHORS COPYING ChangeLog INSTALL NEWS \ + README compile config.guess config.sub install-sh missing \ + ltmain.sh 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 \ @@ -104,21 +131,28 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(pkgconfigdir)" LTLIBRARIES = $(pyexec_LTLIBRARIES) +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_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 = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -127,11 +161,33 @@ am__can_run_installinfo = \ DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) @@ -142,6 +198,7 @@ am__remove_distdir = \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi +am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -169,6 +226,7 @@ am__relativize = \ reldir="$$dir2" GZIP_ENV = --best DIST_ARCHIVES = $(distdir).tar.xz +DIST_TARGETS = dist-xz distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -454,6 +512,7 @@ pygobject-3.0-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/pygobject- cd $(top_builddir) && $(SHELL) ./config.status $@ PKG-INFO: $(top_builddir)/config.status $(srcdir)/PKG-INFO.in cd $(top_builddir) && $(SHELL) ./config.status $@ + install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \ @@ -480,12 +539,14 @@ uninstall-pyexecLTLIBRARIES: clean-pyexecLTLIBRARIES: -test -z "$(pyexec_LTLIBRARIES)" || rm -f $(pyexec_LTLIBRARIES) - @list='$(pyexec_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(pyexec_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } mostlyclean-libtool: -rm -f *.lo @@ -518,22 +579,25 @@ uninstall-pkgconfigDATA: dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -548,57 +612,12 @@ $(RECURSIVE_TARGETS): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -614,12 +633,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -631,15 +645,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -648,9 +658,31 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) @@ -721,39 +753,35 @@ distdir: $(DISTFILES) || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__remove_distdir) + $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) + $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) + $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) + $(am__post_remove_distdir) -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__remove_distdir) +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -764,8 +792,6 @@ distcheck: dist GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ @@ -777,9 +803,9 @@ distcheck: dist *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod u+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ @@ -811,7 +837,7 @@ distcheck: dist && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 - $(am__remove_distdir) + $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' @@ -953,14 +979,13 @@ ps-am: uninstall-am: uninstall-local uninstall-pkgconfigDATA \ uninstall-pyexecLTLIBRARIES -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ - ctags-recursive install-am install-strip tags-recursive +.MAKE: $(am__recursive_targets) all install-am install-strip -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - clean-libtool clean-pyexecLTLIBRARIES ctags ctags-recursive \ - dist dist-all dist-bzip2 dist-gzip dist-hook dist-lzip \ - dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool clean-pyexecLTLIBRARIES cscope cscopelist-am \ + ctags ctags-am dist dist-all dist-bzip2 dist-gzip dist-hook \ + dist-lzip dist-shar dist-tarZ dist-xz dist-zip distcheck \ distclean distclean-generic distclean-hdr distclean-libtool \ distclean-local distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ @@ -973,7 +998,7 @@ uninstall-am: uninstall-local uninstall-pkgconfigDATA \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-local \ + tags tags-am uninstall uninstall-am uninstall-local \ uninstall-pkgconfigDATA uninstall-pyexecLTLIBRARIES @@ -1,3 +1,44 @@ +3.9.3 29-Jul-2013 + - Ensure exceptions set in closure out argument marshaling are printed + (Simon Feltman) (#705064) + - Always raise OverflowError for marshaling integers from Python + (not ValueError or OverflowError) (Simon Feltman) (#705057) + - Cleanup invoke args and kwargs combiner code (Simon Feltman) (#640812) + - gtk-demo: Change demo to use Gtk.Application (Simon Feltman) (#698547) + - Add callable and descriptor protocols to PyGICallableInfo + (Simon Feltman) (#704037) + - Unify basic type argument marshaling for methods, closures, and + properties (Simon Feltman) (#693405) + - Override GValue.set/get_boxed with static C marshaler + (Simon Feltman) (#688081, #693405) + - Add deprecation warning for marshaling arbitrary objects as pointers + (Simon Feltman) (#688081) + - Replace usage of __import__ with importlib.import_module + (Simon Feltman) (#682320) + - Always unref the GiTypeInfo when generating an argument cache + (Mike Gorse) (#703973) + - Unref interface info when fetching enums or flags + (Mike Gorse) (#703960) + - Speed up MRO calculation (Daniel Drake) (#703829) + - Add GIL safety to pyobject_copy for copying boxed PyObjects + (Simon Feltman) (#688081) + - Add marshaling of GI_TYPE_TAG_VOID held in a GValue to int + (Simon Feltman) (#694233) + - GTK overrides: Make connect_signals handle tuple + (Cole Robinson) (#693994) + - Re-add support for passing GValue's by reference + (Simon Feltman) (#701058) + - Clear return value of closures to zero when an exception occurs + (Simon Feltman) (#702552) + - Don't use doctest syntax in docstrings for examples + (Martin Pitt) (#701009) + - Add support for properties of type GInterface + (Garrett Regier) (#703456) + - pygtkcompat: Fix for missing methods on Windows + (Martin Pitt) (#702787) + - gi/pygi-info.c: Avoid C99-style variable declaration + (Chun-wei Fan) (#702786) + 3.9.2 28-May-2013 - examples/option.py: Port to GI and Python 3 (Martin Pitt) - Fix vfunc info search for classes with multiple inheritance @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: PyGObject -Version: 3.9.2 +Version: 3.9.5 Summary: Python bindings for GObject Home-page: http://www.pygtk.org/ Author: James Henstridge @@ -8,7 +8,7 @@ Author-email: james@daa.com.au Maintainer: Johan Dahlin Maintainer-email: johan@gnome.org License: GNU LGPL -Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.2.tar.gz +Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.5.tar.gz Description: Python bindings for GLib and GObject Platform: POSIX, Windows Classifier: Development Status :: 5 - Production/Stable @@ -1,8 +1,7 @@ -# generated automatically by aclocal 1.11.6 -*- Autoconf -*- +# generated automatically by aclocal 1.13.2 -*- Autoconf -*- + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, -# Inc. # This file 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. @@ -12,33 +11,31 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. 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'.])]) +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file 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. -# serial 1 - # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' +[am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.6], [], +m4_if([$1], [1.13.2], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -54,24 +51,22 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.6])dnl +[AM_AUTOMAKE_VERSION([1.13.2])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. -# serial 1 - # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and @@ -90,7 +85,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you +# harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, @@ -116,22 +111,19 @@ am_aux_dir=`cd $ac_aux_dir && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file 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. -# serial 9 - # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl @@ -150,16 +142,14 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, -# 2010, 2011 Free Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file 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. -# serial 12 -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing @@ -169,7 +159,7 @@ fi])]) # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was @@ -182,12 +172,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], @@ -195,8 +186,8 @@ AC_CACHE_CHECK([dependency style of $depcc], # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -236,16 +227,16 @@ AC_CACHE_CHECK([dependency style of $depcc], : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -254,8 +245,8 @@ AC_CACHE_CHECK([dependency style of $depcc], test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else @@ -263,7 +254,7 @@ AC_CACHE_CHECK([dependency style of $depcc], fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -311,7 +302,7 @@ AM_CONDITIONAL([am__fastdep$1], [ # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl @@ -321,9 +312,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' @@ -338,20 +333,18 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file 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. -#serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ - # Autoconf 2.62 quotes --file arguments for eval, but not when files + # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in @@ -364,7 +357,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -376,21 +369,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue + test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` @@ -408,7 +399,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will +# is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], @@ -418,15 +409,12 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file 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. -# serial 16 - # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -442,7 +430,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.62])dnl +[AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -471,31 +459,40 @@ AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl @@ -506,28 +503,32 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) -_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro -dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], @@ -555,15 +556,12 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, -# Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. -# serial 1 - # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. @@ -577,16 +575,14 @@ if test x"${install_sh}" != xset; then install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi -AC_SUBST(install_sh)]) +AC_SUBST([install_sh])]) -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file 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. -# serial 2 - # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], @@ -602,14 +598,12 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. -# serial 4 - # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. @@ -627,7 +621,7 @@ am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -652,15 +646,12 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file 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. -# serial 6 - # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. @@ -689,15 +680,12 @@ m4_define([AC_PROG_CC], # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file 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. -# serial 6 - # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], @@ -705,11 +693,10 @@ AC_DEFUN([AM_MISSING_PROG], $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) - # AM_MISSING_HAS_RUN # ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl @@ -722,54 +709,22 @@ if test x"${MISSING+set}" != xset; then esac fi # Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " else am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) + AC_MSG_WARN(['missing' script is too old or missing]) fi ]) -# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, -# Inc. -# -# This file 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. - -# serial 1 - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. -# serial 5 - # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], @@ -779,7 +734,7 @@ AC_DEFUN([_AM_MANGLE_OPTION], # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ @@ -793,14 +748,12 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, -# 2011 Free Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file 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. -# serial 2 # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------------- @@ -829,7 +782,7 @@ AC_DEFUN([AM_PATH_PYTHON], dnl Find a Python interpreter. Python versions prior to 2.0 are not dnl supported. (2.0 was released on October 16, 2000). m4_define_default([_AM_PYTHON_INTERPRETER_LIST], -[python python2 python3 python3.2 python3.1 python3.0 python2.7 dnl +[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0]) AC_ARG_VAR([PYTHON], [the Python interpreter]) @@ -845,10 +798,11 @@ AC_DEFUN([AM_PATH_PYTHON], dnl A version check is needed. if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. - AC_MSG_CHECKING([whether $PYTHON version >= $1]) + AC_MSG_CHECKING([whether $PYTHON version is >= $1]) AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], - [AC_MSG_RESULT(yes)], - [AC_MSG_ERROR(too old)]) + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Python interpreter is too old])]) am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies @@ -897,6 +851,25 @@ AC_DEFUN([AM_PATH_PYTHON], [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) + # Just factor out some code duplication. + am_python_setup_sysconfig="\ +import sys +# Prefer sysconfig over distutils.sysconfig, for better compatibility +# with python 3.x. See automake bug#10227. +try: + import sysconfig +except ImportError: + can_use_sysconfig = 0 +else: + can_use_sysconfig = 1 +# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: +# <https://github.com/pypa/virtualenv/issues/118> +try: + from platform import python_implementation + if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': + can_use_sysconfig = 0 +except ImportError: + pass" dnl Set up 4 directories: @@ -913,7 +886,14 @@ AC_DEFUN([AM_PATH_PYTHON], else am_py_prefix=$prefix fi - am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null` + am_cv_python_pythondir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` @@ -948,7 +928,14 @@ AC_DEFUN([AM_PATH_PYTHON], else am_py_exec_prefix=$exec_prefix fi - am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null` + am_cv_python_pyexecdir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` @@ -996,14 +983,12 @@ for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] sys.exit(sys.hexversion < minverhex)" AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. -# serial 1 - # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. @@ -1017,22 +1002,16 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file 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. -# serial 5 - # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -1043,32 +1022,40 @@ case `pwd` in esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac -# Do `set' in a subshell so we don't clobber the current shell's +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$[2]" = conftest.file ) then @@ -1078,31 +1065,50 @@ else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -AC_MSG_RESULT(yes)]) +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) -# Copyright (C) 2009, 2011 Free Software Foundation, Inc. +# Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file 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. -# serial 2 - # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT -# (`yes' being less verbose, `no' or empty being verbose). +# ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], -[ --enable-silent-rules less verbose build output (undo: `make V=1') - --disable-silent-rules verbose build output (undo: `make V=0')]) -case $enable_silent_rules in -yes) AM_DEFAULT_VERBOSITY=0;; -no) AM_DEFAULT_VERBOSITY=1;; -*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl -dnl A few `make' implementations (e.g., NonStop OS and NextStep) +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} @@ -1120,7 +1126,7 @@ else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then - dnl Using `$V' instead of `$(V)' breaks IRIX make. + dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else @@ -1137,44 +1143,40 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. -# serial 1 - # AM_PROG_INSTALL_STRIP # --------------------- -# One issue with vendor `install' (even GNU) is that you can't +# One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize +# always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. +# Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file 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. -# serial 3 - # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. @@ -1188,18 +1190,16 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. +# Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file 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. -# serial 2 - # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory @@ -1209,76 +1209,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar +# AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. + +# We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar <conftest.tar]) + AM_RUN_LOG([cat conftest.dir/file]) + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi + done rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar <conftest.tar]) - grep GrepMe conftest.dir/file >/dev/null 2>&1 && break - fi -done -rm -rf conftest.dir -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR @@ -1,10 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-03-05.13; # UTC +scriptversion=2012-10-14.11; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free -# Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # Written by Tom Tromey <tromey@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -113,6 +112,11 @@ func_cl_dashl () lib=$dir/$lib.lib break fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi done IFS=$save_IFS diff --git a/config.guess b/config.guess index d622a44..120cc0d 100755 --- a/config.guess +++ b/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2012-02-10' +timestamp='2013-05-16' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# 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 @@ -22,19 +20,17 @@ timestamp='2012-02-10' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to <config-patches@gnu.org> and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -54,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -200,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -302,7 +321,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -801,6 +820,9 @@ EOF i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; @@ -852,21 +874,21 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -879,59 +901,54 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -950,54 +967,57 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1201,6 +1221,9 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1227,19 +1250,21 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1256,7 +1281,7 @@ EOF NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1330,9 +1355,6 @@ EOF exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c <<EOF #ifdef _SEQUENT_ @@ -1,24 +1,18 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2012-04-18' +timestamp='2013-04-24' -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# 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. +# 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 <http://www.gnu.org/licenses/>. @@ -26,11 +20,12 @@ timestamp='2012-04-18' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -73,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -123,7 +116,7 @@ esac maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) @@ -156,7 +149,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -259,8 +252,10 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ @@ -273,7 +268,7 @@ case $basic_machine in | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -291,16 +286,17 @@ case $basic_machine in | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ - | or32 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ @@ -370,7 +366,7 @@ case $basic_machine in | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ @@ -389,7 +385,8 @@ case $basic_machine in | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -407,12 +404,13 @@ case $basic_machine in | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ @@ -788,9 +786,13 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1019,7 +1021,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1346,21 +1352,21 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1492,9 +1498,6 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; @@ -1586,6 +1589,9 @@ case $basic_machine in mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for pygobject 3.9.2. +# Generated by GNU Autoconf 2.69 for pygobject 3.9.5. # # Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pygobject' PACKAGE_TARNAME='pygobject' -PACKAGE_VERSION='3.9.2' -PACKAGE_STRING='pygobject 3.9.2' +PACKAGE_VERSION='3.9.5' +PACKAGE_STRING='pygobject 3.9.5' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject' PACKAGE_URL='https://live.gnome.org/PyGObject/' @@ -1395,7 +1395,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pygobject 3.9.2 to adapt to many kinds of systems. +\`configure' configures pygobject 3.9.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1465,7 +1465,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pygobject 3.9.2:";; + short | recursive ) echo "Configuration of pygobject 3.9.5:";; esac cat <<\_ACEOF @@ -1473,14 +1473,16 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: `make V=1') - --disable-silent-rules verbose build output (undo: `make V=0') + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") --enable-static[=PKGS] build static libraries [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors + --enable-dependency-tracking + do not reject slow dependency extractors + --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 @@ -1600,7 +1602,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pygobject configure 3.9.2 +pygobject configure 3.9.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1878,7 +1880,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pygobject $as_me 3.9.2, which was +It was created by pygobject $as_me 3.9.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2242,9 +2244,9 @@ $as_echo "#define PYGOBJECT_MINOR_VERSION 9" >>confdefs.h PYGOBJECT_MINOR_VERSION=9 -$as_echo "#define PYGOBJECT_MICRO_VERSION 2" >>confdefs.h +$as_echo "#define PYGOBJECT_MICRO_VERSION 5" >>confdefs.h -PYGOBJECT_MICRO_VERSION=2 +PYGOBJECT_MICRO_VERSION=5 ac_config_headers="$ac_config_headers config.h" @@ -2254,10 +2256,10 @@ if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi -case $enable_silent_rules in -yes) AM_DEFAULT_VERBOSITY=0;; -no) AM_DEFAULT_VERBOSITY=1;; -*) AM_DEFAULT_VERBOSITY=0;; +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 @@ -2288,7 +2290,7 @@ else fi AM_BACKSLASH='\' -am__api_version='1.11' +am__api_version='1.13' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -2414,9 +2416,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -2427,32 +2426,40 @@ case `pwd` in esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac -# Do `set' in a subshell so we don't clobber the current shell's +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$2" = conftest.file ) then @@ -2464,6 +2471,16 @@ Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. @@ -2486,12 +2503,12 @@ if test x"${MISSING+set}" != xset; then esac fi # Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then @@ -2503,10 +2520,10 @@ if test x"${install_sh}" != xset; then esac fi -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. +# will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. @@ -2645,12 +2662,6 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -2755,7 +2766,7 @@ fi # Define the identity of the package. PACKAGE='pygobject' - VERSION='3.9.2' + VERSION='3.9.5' cat >>confdefs.h <<_ACEOF @@ -2783,12 +2794,22 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +mkdir_p='$(MKDIR_P)' + # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' @@ -2796,6 +2817,7 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" # Make sure we can run config.sub. @@ -3025,7 +3047,7 @@ am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -3869,8 +3891,8 @@ else # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -3905,16 +3927,16 @@ else : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -3923,8 +3945,8 @@ else test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else @@ -3932,7 +3954,7 @@ else fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -12309,8 +12331,8 @@ else # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -12345,16 +12367,16 @@ else : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -12363,8 +12385,8 @@ else test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else @@ -12372,7 +12394,7 @@ else fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -12900,6 +12922,25 @@ $as_echo "$am_cv_python_platform" >&6; } PYTHON_PLATFORM=$am_cv_python_platform + # Just factor out some code duplication. + am_python_setup_sysconfig="\ +import sys +# Prefer sysconfig over distutils.sysconfig, for better compatibility +# with python 3.x. See automake bug#10227. +try: + import sysconfig +except ImportError: + can_use_sysconfig = 0 +else: + can_use_sysconfig = 1 +# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: +# <https://github.com/pypa/virtualenv/issues/118> +try: + from platform import python_implementation + if python_implementation() == 'CPython' and sys.version[:3] == '2.7': + can_use_sysconfig = 0 +except ImportError: + pass" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 @@ -12913,7 +12954,14 @@ else else am_py_prefix=$prefix fi - am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null` + am_cv_python_pythondir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` @@ -12950,7 +12998,14 @@ else else am_py_exec_prefix=$exec_prefix fi - am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null` + am_cv_python_pyexecdir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` @@ -14832,6 +14887,14 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -15269,7 +15332,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by pygobject $as_me 3.9.2, which was +This file was extended by pygobject $as_me 3.9.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15336,7 +15399,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -pygobject config.status 3.9.2 +pygobject config.status 3.9.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -16355,7 +16418,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files + # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in @@ -16368,7 +16431,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -16402,21 +16465,19 @@ $as_echo X"$mf" | continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue + test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || diff --git a/configure.ac b/configure.ac index 350c811..7686553 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ m4_define(python3_min_ver, 3.1) dnl the pygobject version number m4_define(pygobject_major_version, 3) m4_define(pygobject_minor_version, 9) -m4_define(pygobject_micro_version, 2) +m4_define(pygobject_micro_version, 5) m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version) dnl versions of packages we require ... @@ -1,10 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2012-03-27.16; # UTC +scriptversion=2012-10-18.11; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # 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 @@ -28,9 +27,9 @@ scriptversion=2012-03-27.16; # UTC case $1 in '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] @@ -57,11 +56,65 @@ EOF ;; esac +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + # A tabulation character. tab=' ' # A newline character. nl=' ' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 @@ -75,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" +# Avoid interferences from the environment. +gccflag= dashmflag= + # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case @@ -86,32 +142,32 @@ if test "$depmode" = hp; then fi if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 fi if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. - gccflag=-qmakedep=gcc,-MF - depmode=gcc + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc fi case "$depmode" in @@ -134,8 +190,7 @@ gcc3) done "$@" stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi @@ -143,13 +198,17 @@ gcc3) ;; gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then @@ -157,15 +216,14 @@ gcc) fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. + # The second -e expression handles DOS-style file names with drive + # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. @@ -174,15 +232,15 @@ gcc) ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. - tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -200,8 +258,7 @@ sgi) "$@" -MDupdate "$tmpdepfile" fi stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi @@ -209,7 +266,6 @@ sgi) if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" - # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in @@ -217,19 +273,15 @@ sgi) # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr "$nl" ' ' >> "$depfile" + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" - # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" + make_dummy_depfile fi rm -f "$tmpdepfile" ;; @@ -247,9 +299,8 @@ aix) # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + set_dir_from "$object" + set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u @@ -262,9 +313,7 @@ aix) "$@" -M fi stat=$? - - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi @@ -273,65 +322,113 @@ aix) do test -f "$tmpdepfile" && break done - if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependent.h'. - # Do two passes, one to just change these to - # '$object: dependent.h' and one to simply 'dependent.h:'. - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; -icc) - # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. - # However on - # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\': + # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... - # tcc 0.9.26 (FIXME still under development at the moment of writing) - # will emit a similar output, but also prepend the continuation lines - # with horizontal tabulation characters. - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" - # Each line is of the form 'foo.o: dependent.h', - # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to - # '$object: dependent.h' and one to simply 'dependent.h:'. - sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ - < "$tmpdepfile" > "$depfile" - sed ' - s/[ '"$tab"'][ '"$tab"']*/ /g - s/^ *// - s/ *\\*$// - s/^[^:]*: *// - /^$/d - /:$/d - s/$/ :/ - ' < "$tmpdepfile" >> "$depfile" + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -342,9 +439,8 @@ hp2) # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + set_dir_from "$object" + set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d @@ -355,8 +451,7 @@ hp2) "$@" +Maked fi stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi @@ -366,76 +461,61 @@ hp2) test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" else - echo "#dummy" > "$depfile" + make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in 'foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mechanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; msvc7) if test "$libtool" = yes; then @@ -446,8 +526,7 @@ msvc7) "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" - if test "$stat" = 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi @@ -524,13 +603,14 @@ dashmstdout) # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | - sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" - tr ' ' "$nl" < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -583,10 +663,12 @@ makedepend) # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; @@ -622,10 +704,10 @@ cpp) esac done - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" @@ -657,15 +739,15 @@ msvisualcpp) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; + set fnord "$@" + shift + shift + ;; *) - set fnord "$@" "$arg" - shift - shift - ;; + set fnord "$@" "$arg" + shift + shift + ;; esac done "$@" -E 2>/dev/null | diff --git a/examples/Makefile.in b/examples/Makefile.in index 50450bc..0f3bbec 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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. @@ -15,23 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + 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; \ - test $$am__dry = yes; \ - } + 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@ @@ -51,7 +78,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = examples -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am 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 \ @@ -64,12 +91,18 @@ 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_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 = \ @@ -77,6 +110,7 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ @@ -283,11 +317,11 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -tags: TAGS -TAGS: +tags TAGS: + +ctags CTAGS: -ctags: CTAGS -CTAGS: +cscope cscopelist: distdir: $(DISTFILES) @@ -423,15 +457,16 @@ uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - 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-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am + 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-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 # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/gi/Makefile.am b/gi/Makefile.am index c687d31..fc11ff8 100644 --- a/gi/Makefile.am +++ b/gi/Makefile.am @@ -31,7 +31,8 @@ pygi_PYTHON = \ types.py \ module.py \ importer.py \ - pygtkcompat.py + pygtkcompat.py \ + docstring.py pygi_LTLIBRARIES = _gi.la diff --git a/gi/Makefile.in b/gi/Makefile.in index dd02a4c..317ef0c 100644 --- a/gi/Makefile.in +++ b/gi/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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. @@ -16,23 +15,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + 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@ @@ -56,8 +83,8 @@ host_triplet = @host@ @ENABLE_CAIRO_TRUE@am__append_2 = _gi_cairo.la subdir = gi -DIST_COMMON = $(pygi_PYTHON) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp $(pygi_PYTHON) $(top_srcdir)/py-compile 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 \ @@ -116,6 +143,7 @@ _gi_la_OBJECTS = $(am__gi_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +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 $@ @@ -127,6 +155,18 @@ _gi_cairo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gi_cairo_la_CFLAGS) \ $(CFLAGS) $(_gi_cairo_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_CAIRO_TRUE@am__gi_cairo_la_rpath = -rpath $(pygidir) +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 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -139,41 +179,60 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -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_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(_gi_la_SOURCES) $(_gi_cairo_la_SOURCES) DIST_SOURCES = $(_gi_la_SOURCES) $(_gi_cairo_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) +am__pep3147_tweak = \ + sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' py_compile = $(top_srcdir)/py-compile RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -393,7 +452,8 @@ pygi_PYTHON = \ types.py \ module.py \ importer.py \ - pygtkcompat.py + pygtkcompat.py \ + docstring.py pygi_LTLIBRARIES = _gi.la $(am__append_2) _gi_la_SOURCES = \ @@ -509,6 +569,7 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): + install-pygiLTLIBRARIES: $(pygi_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pygi_LTLIBRARIES)'; test -n "$(pygidir)" || list=; \ @@ -535,14 +596,18 @@ uninstall-pygiLTLIBRARIES: clean-pygiLTLIBRARIES: -test -z "$(pygi_LTLIBRARIES)" || rm -f $(pygi_LTLIBRARIES) - @list='$(pygi_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(pygi_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + _gi.la: $(_gi_la_OBJECTS) $(_gi_la_DEPENDENCIES) $(EXTRA__gi_la_DEPENDENCIES) $(AM_V_CCLD)$(_gi_la_LINK) -rpath $(pygidir) $(_gi_la_OBJECTS) $(_gi_la_LIBADD) $(LIBS) + _gi_cairo.la: $(_gi_cairo_la_OBJECTS) $(_gi_cairo_la_DEPENDENCIES) $(EXTRA__gi_cairo_la_DEPENDENCIES) $(AM_V_CCLD)$(_gi_cairo_la_LINK) $(am__gi_cairo_la_rpath) $(_gi_cairo_la_OBJECTS) $(_gi_cairo_la_LIBADD) $(LIBS) @@ -752,45 +817,54 @@ install-pygiPYTHON: $(pygi_PYTHON) $(INSTALL_DATA) $$files "$(DESTDIR)$(pygidir)" || exit $$?; \ done || exit $$?; \ if test -n "$$dlist"; then \ - if test -z "$(DESTDIR)"; then \ - $(am__py_compile) --basedir "$(pygidir)" $$dlist; \ - else \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygidir)" $$dlist; \ - fi; \ + $(am__py_compile) --destdir "$(DESTDIR)" \ + --basedir "$(pygidir)" $$dlist; \ else :; fi uninstall-pygiPYTHON: @$(NORMAL_UNINSTALL) @list='$(pygi_PYTHON)'; test -n "$(pygidir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ + py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$py_files" || exit 0; \ dir='$(DESTDIR)$(pygidir)'; \ - filesc=`echo "$$files" | sed 's|$$|c|'`; \ - fileso=`echo "$$files" | sed 's|$$|o|'`; \ + 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 "$$files" "$$filesc" "$$fileso"; do \ + 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 # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -805,57 +879,12 @@ $(RECURSIVE_TARGETS): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -871,12 +900,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -888,15 +912,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -905,6 +925,21 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -1074,25 +1109,24 @@ ps-am: uninstall-am: uninstall-pygiLTLIBRARIES uninstall-pygiPYTHON -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ - ctags-recursive install-am install-strip tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am all-local check check-am check-local clean \ - clean-generic clean-libtool clean-local clean-pygiLTLIBRARIES \ - ctags ctags-recursive distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am \ - install-pygiLTLIBRARIES install-pygiPYTHON install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-pygiLTLIBRARIES uninstall-pygiPYTHON +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \ + check check-am check-local clean clean-generic clean-libtool \ + clean-local clean-pygiLTLIBRARIES cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-pygiLTLIBRARIES \ + install-pygiPYTHON install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-pygiLTLIBRARIES \ + uninstall-pygiPYTHON # This is to ensure we have a symlink to the .so in the diff --git a/gi/__init__.py b/gi/__init__.py index e8c12db..0645d44 100644 --- a/gi/__init__.py +++ b/gi/__init__.py @@ -24,7 +24,9 @@ from __future__ import absolute_import from pkgutil import extend_path __path__ = extend_path(__path__, __name__) -from ._gi import _API, Repository +from ._gi import _API +from ._gi import Repository +from ._gi import PyGIDeprecationWarning # Force loading the GObject typelib so we have available the wrappers for # base classes such as GInitiallyUnowned @@ -32,6 +34,7 @@ import gi._gobject gi # pyflakes _API = _API # pyflakes +PyGIDeprecationWarning = PyGIDeprecationWarning import os @@ -81,17 +84,3 @@ def require_version(namespace, version): def get_required_version(namespace): return _versions.get(namespace, None) - - -# Use RuntimeWarning as the base class of PyGIDeprecationWarning -# for unstable (odd minor version) and use DeprecationWarning for -# stable (even minor version). This is so PyGObject deprecations -# behave the same as regular Python deprecations in stable releases. -if version_info[1] % 2: - _DeprecationWarningBase = RuntimeWarning -else: - _DeprecationWarningBase = DeprecationWarning - - -class PyGIDeprecationWarning(_DeprecationWarningBase): - pass diff --git a/gi/_glib/Makefile.in b/gi/_glib/Makefile.in index 2829376..3b285e9 100644 --- a/gi/_glib/Makefile.in +++ b/gi/_glib/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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. @@ -16,23 +15,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + 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@ @@ -56,8 +83,9 @@ host_triplet = @host@ @PLATFORM_WIN32_TRUE@am__append_2 = -DPLATFORM_WIN32 subdir = gi/_glib -DIST_COMMON = $(pyglib_PYTHON) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp $(pyglib_PYTHON) \ + $(top_srcdir)/py-compile 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 \ @@ -111,6 +139,7 @@ _glib_la_OBJECTS = $(am__glib_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = _glib_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_glib_la_CFLAGS) \ $(CFLAGS) $(_glib_la_LDFLAGS) $(LDFLAGS) -o $@ @@ -126,6 +155,18 @@ libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LINK = $(LIBTOOL) $(AM_V_lt) \ $(CCLD) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CFLAGS) \ $(CFLAGS) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LDFLAGS) \ $(LDFLAGS) -o $@ +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 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -138,20 +179,16 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -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_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(_glib_la_SOURCES) \ $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_SOURCES) DIST_SOURCES = $(_glib_la_SOURCES) \ @@ -162,7 +199,26 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) +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) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -428,6 +484,7 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): + install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ @@ -454,12 +511,15 @@ uninstall-libLTLIBRARIES: clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + install-pyglibLTLIBRARIES: $(pyglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pyglib_LTLIBRARIES)'; test -n "$(pyglibdir)" || list=; \ @@ -486,14 +546,18 @@ uninstall-pyglibLTLIBRARIES: clean-pyglibLTLIBRARIES: -test -z "$(pyglib_LTLIBRARIES)" || rm -f $(pyglib_LTLIBRARIES) - @list='$(pyglib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(pyglib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + _glib.la: $(_glib_la_OBJECTS) $(_glib_la_DEPENDENCIES) $(EXTRA__glib_la_DEPENDENCIES) $(AM_V_CCLD)$(_glib_la_LINK) -rpath $(pyglibdir) $(_glib_la_OBJECTS) $(_glib_la_LIBADD) $(LIBS) + libpyglib-gi-2.0-@PYTHON_BASENAME@.la: $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_OBJECTS) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_DEPENDENCIES) $(EXTRA_libpyglib_gi_2_0_@PYTHON_BASENAME@_la_DEPENDENCIES) $(AM_V_CCLD)$(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LINK) -rpath $(libdir) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_OBJECTS) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LIBADD) $(LIBS) @@ -591,48 +655,43 @@ install-pyglibPYTHON: $(pyglib_PYTHON) $(INSTALL_DATA) $$files "$(DESTDIR)$(pyglibdir)" || exit $$?; \ done || exit $$?; \ if test -n "$$dlist"; then \ - if test -z "$(DESTDIR)"; then \ - $(am__py_compile) --basedir "$(pyglibdir)" $$dlist; \ - else \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pyglibdir)" $$dlist; \ - fi; \ + $(am__py_compile) --destdir "$(DESTDIR)" \ + --basedir "$(pyglibdir)" $$dlist; \ else :; fi uninstall-pyglibPYTHON: @$(NORMAL_UNINSTALL) @list='$(pyglib_PYTHON)'; test -n "$(pyglibdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ + py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$py_files" || exit 0; \ dir='$(DESTDIR)$(pyglibdir)'; \ - filesc=`echo "$$files" | sed 's|$$|c|'`; \ - fileso=`echo "$$files" | sed 's|$$|o|'`; \ + 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 "$$files" "$$filesc" "$$fileso"; do \ + 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 -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -644,15 +703,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -661,6 +716,21 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -807,22 +877,22 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-pyglibLTLIBRARIES \ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ - clean-pyglibLTLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-libLTLIBRARIES \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-pyglibLTLIBRARIES install-pyglibPYTHON \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-libLTLIBRARIES uninstall-pyglibLTLIBRARIES \ - uninstall-pyglibPYTHON + clean-pyglibLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-pyglibLTLIBRARIES \ + install-pyglibPYTHON install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \ + uninstall-pyglibLTLIBRARIES uninstall-pyglibPYTHON # if we build in a separate tree, we need to symlink the *.py files from the diff --git a/gi/_glib/pyglib-python-compat.h b/gi/_glib/pyglib-python-compat.h index 96c27ca..7b4c595 100644 --- a/gi/_glib/pyglib-python-compat.h +++ b/gi/_glib/pyglib-python-compat.h @@ -87,6 +87,8 @@ static int _pyglib_init_##modname(PyObject *module) #define PYGLIB_PyUnicode_AS_STRING PyString_AS_STRING #define PYGLIB_PyUnicode_GET_SIZE PyString_GET_SIZE #define PYGLIB_PyUnicode_Type PyString_Type +#define PYGLIB_PyUnicode_InternFromString PyString_InternFromString +#define PYGLIB_PyUnicode_InternInPlace PyString_InternInPlace #define PYGLIB_PyBytes_FromString PyString_FromString #define PYGLIB_PyBytes_FromStringAndSize PyString_FromStringAndSize @@ -191,6 +193,9 @@ PyTypeObject symbol = { \ #define PYGLIB_PyUnicode_GET_SIZE PyUnicode_GET_SIZE #define PYGLIB_PyUnicode_Resize PyUnicode_Resize #define PYGLIB_PyUnicode_Type PyUnicode_Type +#define PYGLIB_PyUnicode_InternFromString PyUnicode_InternFromString +#define PYGLIB_PyUnicode_InternInPlace PyUnicode_InternInPlace + #define PYGLIB_PyLong_Check PyLong_Check #define PYGLIB_PyLong_FromLong PyLong_FromLong #define PYGLIB_PyLong_AsLong PyLong_AsLong diff --git a/gi/_gobject/Makefile.in b/gi/_gobject/Makefile.in index ce28f0e..e621540 100644 --- a/gi/_gobject/Makefile.in +++ b/gi/_gobject/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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. @@ -17,23 +16,51 @@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + 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@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -55,8 +82,9 @@ host_triplet = @host@ @OS_WIN32_TRUE@ -no-undefined subdir = gi/_gobject -DIST_COMMON = $(pkginclude_HEADERS) $(pygobject_PYTHON) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp $(pygobject_PYTHON) \ + $(top_srcdir)/py-compile $(pkginclude_HEADERS) 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 \ @@ -113,9 +141,22 @@ _gobject_la_OBJECTS = $(am__gobject_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = _gobject_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gobject_la_CFLAGS) \ $(CFLAGS) $(_gobject_la_LDFLAGS) $(LDFLAGS) -o $@ +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 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -128,20 +169,16 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -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_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(_gobject_la_SOURCES) DIST_SOURCES = $(_gobject_la_SOURCES) am__can_run_installinfo = \ @@ -150,8 +187,27 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) +am__pep3147_tweak = \ + sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' py_compile = $(top_srcdir)/py-compile HEADERS = $(pkginclude_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -419,6 +475,7 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): + install-pygobjectLTLIBRARIES: $(pygobject_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pygobject_LTLIBRARIES)'; test -n "$(pygobjectdir)" || list=; \ @@ -445,12 +502,15 @@ uninstall-pygobjectLTLIBRARIES: clean-pygobjectLTLIBRARIES: -test -z "$(pygobject_LTLIBRARIES)" || rm -f $(pygobject_LTLIBRARIES) - @list='$(pygobject_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(pygobject_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + _gobject.la: $(_gobject_la_OBJECTS) $(_gobject_la_DEPENDENCIES) $(EXTRA__gobject_la_DEPENDENCIES) $(AM_V_CCLD)$(_gobject_la_LINK) -rpath $(pygobjectdir) $(_gobject_la_OBJECTS) $(_gobject_la_LIBADD) $(LIBS) @@ -580,24 +640,30 @@ install-pygobjectPYTHON: $(pygobject_PYTHON) $(INSTALL_DATA) $$files "$(DESTDIR)$(pygobjectdir)" || exit $$?; \ done || exit $$?; \ if test -n "$$dlist"; then \ - if test -z "$(DESTDIR)"; then \ - $(am__py_compile) --basedir "$(pygobjectdir)" $$dlist; \ - else \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygobjectdir)" $$dlist; \ - fi; \ + $(am__py_compile) --destdir "$(DESTDIR)" \ + --basedir "$(pygobjectdir)" $$dlist; \ else :; fi uninstall-pygobjectPYTHON: @$(NORMAL_UNINSTALL) @list='$(pygobject_PYTHON)'; test -n "$(pygobjectdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ + py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$py_files" || exit 0; \ dir='$(DESTDIR)$(pygobjectdir)'; \ - filesc=`echo "$$files" | sed 's|$$|c|'`; \ - fileso=`echo "$$files" | sed 's|$$|o|'`; \ + 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 "$$files" "$$filesc" "$$fileso"; do \ + 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 @@ -623,26 +689,15 @@ uninstall-pkgincludeHEADERS: files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -654,15 +709,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -671,6 +722,21 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -818,22 +884,23 @@ uninstall-am: uninstall-pkgincludeHEADERS \ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ clean-generic clean-libtool clean-local \ - clean-pygobjectLTLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-pkgincludeHEADERS install-ps \ - install-ps-am install-pygobjectLTLIBRARIES \ - install-pygobjectPYTHON install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-pkgincludeHEADERS \ - uninstall-pygobjectLTLIBRARIES uninstall-pygobjectPYTHON + clean-pygobjectLTLIBRARIES cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pkgincludeHEADERS install-ps install-ps-am \ + install-pygobjectLTLIBRARIES install-pygobjectPYTHON \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-pkgincludeHEADERS uninstall-pygobjectLTLIBRARIES \ + uninstall-pygobjectPYTHON # if we build in a separate tree, we need to symlink the *.py files from the diff --git a/gi/_gobject/gobjectmodule.c b/gi/_gobject/gobjectmodule.c index 1e1cbd8..ac37904 100644 --- a/gi/_gobject/gobjectmodule.c +++ b/gi/_gobject/gobjectmodule.c @@ -623,6 +623,7 @@ create_property (const gchar *prop_name, pspec = g_param_spec_pointer (prop_name, nick, blurb, flags); break; case G_TYPE_OBJECT: + case G_TYPE_INTERFACE: if (!PyArg_ParseTuple(args, "")) return NULL; pspec = g_param_spec_object (prop_name, nick, blurb, prop_type, flags); @@ -1657,6 +1658,40 @@ pyg__install_metaclass(PyObject *dummy, PyTypeObject *metaclass) return Py_None; } +static PyObject * +pyg__gvalue_get(PyObject *module, PyObject *pygvalue) +{ + if (!pyg_boxed_check (pygvalue, G_TYPE_VALUE)) { + PyErr_SetString (PyExc_TypeError, "Expected GValue argument."); + return NULL; + } + + return pyg_value_as_pyobject (pyg_boxed_get(pygvalue, GValue), + /*copy_boxed=*/ TRUE); +} + +static PyObject * +pyg__gvalue_set(PyObject *module, PyObject *args) +{ + PyObject *pygvalue; + PyObject *pyobject; + + if (!PyArg_ParseTuple (args, "OO:_gobject._gvalue_set", + &pygvalue, &pyobject)) + return NULL; + + if (!pyg_boxed_check (pygvalue, G_TYPE_VALUE)) { + PyErr_SetString (PyExc_TypeError, "Expected GValue argument."); + return NULL; + } + + if (pyg_value_from_pyobject_with_error (pyg_boxed_get (pygvalue, GValue), + pyobject) == -1) + return NULL; + + Py_RETURN_NONE; +} + static PyMethodDef _gobject_functions[] = { { "type_name", pyg_type_name, METH_VARARGS }, { "type_from_name", pyg_type_from_name, METH_VARARGS }, @@ -1675,6 +1710,10 @@ static PyMethodDef _gobject_functions[] = { (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 } }; @@ -2071,7 +2110,9 @@ struct _PyGObject_Functions pygobject_api_functions = { pyg_type_from_object_strict, pygobject_new_full, - &PyGObject_Type + &PyGObject_Type, + + pyg_value_from_pyobject_with_error }; /* for addon libraries ... */ diff --git a/gi/_gobject/propertyhelper.py b/gi/_gobject/propertyhelper.py index e8ccb35..162d30a 100644 --- a/gi/_gobject/propertyhelper.py +++ b/gi/_gobject/propertyhelper.py @@ -48,14 +48,13 @@ class Property(object): Creates a new property which in conjunction with GObject subclass will create a property proxy: - >>> class MyObject(GObject.GObject): - >>> ... prop = GObject.Property(type=str) + class MyObject(GObject.GObject): + ... prop = GObject.Property(type=str) - >>> obj = MyObject() - >>> obj.prop = 'value' + obj = MyObject() + obj.prop = 'value' - >>> obj.prop - 'value' + obj.prop # now is 'value' The API is similar to the builtin property: @@ -261,7 +260,8 @@ class Property(object): issubclass(type_, (_gobject.GObject, _gobject.GEnum, _gobject.GFlags, - _gobject.GBoxed))): + _gobject.GBoxed, + _gobject.GInterface))): return type_.__gtype__ elif type_ in (TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR, TYPE_INT, TYPE_UINT, TYPE_BOOLEAN, TYPE_LONG, diff --git a/gi/_gobject/pygobject-private.h b/gi/_gobject/pygobject-private.h index e2a0af7..294b0f6 100644 --- a/gi/_gobject/pygobject-private.h +++ b/gi/_gobject/pygobject-private.h @@ -85,6 +85,7 @@ void pyg_register_gtype_custom(GType gtype, fromvaluefunc from_func, tovaluefunc to_func); int pyg_value_from_pyobject(GValue *value, PyObject *obj); +int pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj); PyObject *pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed); int pyg_param_gvalue_from_pyobject(GValue* value, PyObject* py_obj, diff --git a/gi/_gobject/pygobject.c b/gi/_gobject/pygobject.c index 875da17..126c80e 100644 --- a/gi/_gobject/pygobject.c +++ b/gi/_gobject/pygobject.c @@ -2386,8 +2386,11 @@ static gpointer pyobject_copy(gpointer boxed) { PyObject *object = boxed; + PyGILState_STATE state; + state = pyglib_gil_state_ensure(); Py_INCREF(object); + pyglib_gil_state_release(state); return object; } diff --git a/gi/_gobject/pygobject.h b/gi/_gobject/pygobject.h index f6b531d..76b8b11 100644 --- a/gi/_gobject/pygobject.h +++ b/gi/_gobject/pygobject.h @@ -195,6 +195,7 @@ struct _PyGObject_Functions { PyObject *(* newgobj_full)(GObject *obj, gboolean steal, gpointer g_class); PyTypeObject *object_type; + int (* value_from_pyobject_with_error)(GValue *value, PyObject *obj); }; @@ -244,6 +245,7 @@ struct _PyGObject_Functions *_PyGObject_API; #define pyg_flags_get_value (_PyGObject_API->flags_get_value) #define pyg_register_gtype_custom (_PyGObject_API->register_gtype_custom) #define pyg_value_from_pyobject (_PyGObject_API->value_from_pyobject) +#define pyg_value_from_pyobject_with_error (_PyGObject_API->value_from_pyobject_with_error) #define pyg_value_as_pyobject (_PyGObject_API->value_as_pyobject) #define pyg_register_interface (_PyGObject_API->register_interface) #define PyGBoxed_Type (*_PyGObject_API->boxed_type) diff --git a/gi/_gobject/pygtype.c b/gi/_gobject/pygtype.c index 498c35e..0b920f6 100644 --- a/gi/_gobject/pygtype.c +++ b/gi/_gobject/pygtype.c @@ -663,8 +663,8 @@ pyg_register_gtype_custom(GType gtype, static int pyg_value_array_from_pyobject(GValue *value, - PyObject *obj, - const GParamSpecValueArray *pspec) + PyObject *obj, + const GParamSpecValueArray *pspec) { int len; GValueArray *value_array; @@ -672,55 +672,55 @@ pyg_value_array_from_pyobject(GValue *value, len = PySequence_Length(obj); if (len == -1) { - PyErr_Clear(); - return -1; + PyErr_Clear(); + return -1; } if (pspec && pspec->fixed_n_elements > 0 && len != pspec->fixed_n_elements) - return -1; + return -1; value_array = g_value_array_new(len); for (i = 0; i < len; ++i) { - PyObject *item = PySequence_GetItem(obj, i); - GType type; - GValue item_value = { 0, }; - int status; - - if (! item) { - PyErr_Clear(); - g_value_array_free(value_array); - return -1; - } + PyObject *item = PySequence_GetItem(obj, i); + GType type; + GValue item_value = { 0, }; + int status; + + if (! item) { + PyErr_Clear(); + g_value_array_free(value_array); + return -1; + } - if (pspec && pspec->element_spec) - type = G_PARAM_SPEC_VALUE_TYPE(pspec->element_spec); - else if (item == Py_None) - type = G_TYPE_POINTER; /* store None as NULL */ - else { - type = pyg_type_from_object((PyObject*)Py_TYPE(item)); - if (! type) { - PyErr_Clear(); - g_value_array_free(value_array); - Py_DECREF(item); - return -1; - } - } + if (pspec && pspec->element_spec) + type = G_PARAM_SPEC_VALUE_TYPE(pspec->element_spec); + else if (item == Py_None) + type = G_TYPE_POINTER; /* store None as NULL */ + else { + type = pyg_type_from_object((PyObject*)Py_TYPE(item)); + if (! type) { + PyErr_Clear(); + g_value_array_free(value_array); + Py_DECREF(item); + return -1; + } + } - g_value_init(&item_value, type); - status = (pspec && pspec->element_spec) - ? pyg_param_gvalue_from_pyobject(&item_value, item, pspec->element_spec) - : pyg_value_from_pyobject(&item_value, item); - Py_DECREF(item); + g_value_init(&item_value, type); + status = (pspec && pspec->element_spec) + ? pyg_param_gvalue_from_pyobject(&item_value, item, pspec->element_spec) + : pyg_value_from_pyobject(&item_value, item); + Py_DECREF(item); - if (status == -1) { - g_value_array_free(value_array); - g_value_unset(&item_value); - return -1; - } + if (status == -1) { + g_value_array_free(value_array); + g_value_unset(&item_value); + return -1; + } - g_value_array_append(value_array, &item_value); - g_value_unset(&item_value); + g_value_array_append(value_array, &item_value); + g_value_unset(&item_value); } g_value_take_boxed(value, value_array); @@ -729,7 +729,7 @@ pyg_value_array_from_pyobject(GValue *value, static int pyg_array_from_pyobject(GValue *value, - PyObject *obj) + PyObject *obj) { int len; GArray *array; @@ -737,47 +737,47 @@ pyg_array_from_pyobject(GValue *value, len = PySequence_Length(obj); if (len == -1) { - PyErr_Clear(); - return -1; + PyErr_Clear(); + return -1; } array = g_array_new(FALSE, TRUE, sizeof(GValue)); for (i = 0; i < len; ++i) { - PyObject *item = PySequence_GetItem(obj, i); - GType type; - GValue item_value = { 0, }; - int status; - - if (! item) { - PyErr_Clear(); - g_array_free(array, FALSE); - return -1; - } + PyObject *item = PySequence_GetItem(obj, i); + GType type; + GValue item_value = { 0, }; + int status; + + if (! item) { + PyErr_Clear(); + g_array_free(array, FALSE); + return -1; + } - if (item == Py_None) - type = G_TYPE_POINTER; /* store None as NULL */ - else { - type = pyg_type_from_object((PyObject*)Py_TYPE(item)); - if (! type) { - PyErr_Clear(); - g_array_free(array, FALSE); - Py_DECREF(item); - return -1; - } - } + if (item == Py_None) + type = G_TYPE_POINTER; /* store None as NULL */ + else { + type = pyg_type_from_object((PyObject*)Py_TYPE(item)); + if (! type) { + PyErr_Clear(); + g_array_free(array, FALSE); + Py_DECREF(item); + return -1; + } + } - g_value_init(&item_value, type); - status = pyg_value_from_pyobject(&item_value, item); - Py_DECREF(item); + g_value_init(&item_value, type); + status = pyg_value_from_pyobject(&item_value, item); + Py_DECREF(item); - if (status == -1) { - g_array_free(array, FALSE); - g_value_unset(&item_value); - return -1; - } + if (status == -1) { + g_array_free(array, FALSE); + g_value_unset(&item_value); + return -1; + } - g_array_append_val(array, item_value); + g_array_append_val(array, item_value); } g_value_take_boxed(value, array); @@ -785,7 +785,7 @@ pyg_array_from_pyobject(GValue *value, } /** - * pyg_value_from_pyobject: + * pyg_value_from_pyobject_with_error: * @value: the GValue object to store the converted value in. * @obj: the Python object to convert. * @@ -797,107 +797,110 @@ pyg_array_from_pyobject(GValue *value, * Returns: 0 on success, -1 on error. */ int -pyg_value_from_pyobject(GValue *value, PyObject *obj) +pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj) { PyObject *tmp; GType value_type = G_VALUE_TYPE(value); switch (G_TYPE_FUNDAMENTAL(value_type)) { case G_TYPE_INTERFACE: - /* we only handle interface types that have a GObject prereq */ - if (g_type_is_a(value_type, G_TYPE_OBJECT)) { - if (obj == Py_None) - g_value_set_object(value, NULL); - else { - if (!PyObject_TypeCheck(obj, &PyGObject_Type)) { - return -1; - } - if (!G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), - value_type)) { - return -1; - } - g_value_set_object(value, pygobject_get(obj)); - } - } else { - return -1; - } - break; + /* we only handle interface types that have a GObject prereq */ + if (g_type_is_a(value_type, G_TYPE_OBJECT)) { + if (obj == Py_None) + g_value_set_object(value, NULL); + else { + if (!PyObject_TypeCheck(obj, &PyGObject_Type)) { + PyErr_SetString(PyExc_TypeError, "GObject is required"); + return -1; + } + if (!G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), + value_type)) { + PyErr_SetString(PyExc_TypeError, "Invalid GObject type for assignment"); + return -1; + } + g_value_set_object(value, pygobject_get(obj)); + } + } else { + PyErr_SetString(PyExc_TypeError, "Unsupported conversion"); + return -1; + } + break; case G_TYPE_CHAR: - if (PYGLIB_PyLong_Check(obj)) { - glong val; - val = PYGLIB_PyLong_AsLong(obj); - if (val >= -128 && val <= 127) - g_value_set_schar(value, (gchar) val); - else - return -1; - } + if (PYGLIB_PyLong_Check(obj)) { + glong val; + val = PYGLIB_PyLong_AsLong(obj); + if (val >= -128 && val <= 127) + g_value_set_schar(value, (gchar) val); + else + return -1; + } #if PY_VERSION_HEX < 0x03000000 - else if (PyString_Check(obj)) { - g_value_set_schar(value, PyString_AsString(obj)[0]); - } + else if (PyString_Check(obj)) { + g_value_set_schar(value, PyString_AsString(obj)[0]); + } #endif - else if (PyUnicode_Check(obj)) { - tmp = PyUnicode_AsUTF8String(obj); - g_value_set_schar(value, PYGLIB_PyBytes_AsString(tmp)[0]); - Py_DECREF(tmp); - } else { - PyErr_Clear(); - return -1; - } + else if (PyUnicode_Check(obj)) { + tmp = PyUnicode_AsUTF8String(obj); + g_value_set_schar(value, PYGLIB_PyBytes_AsString(tmp)[0]); + Py_DECREF(tmp); + } else { + PyErr_SetString(PyExc_TypeError, "Cannot convert to TYPE_CHAR"); + return -1; + } - break; + break; case G_TYPE_UCHAR: - if (PYGLIB_PyLong_Check(obj)) { - glong val; - val = PYGLIB_PyLong_AsLong(obj); - if (val >= 0 && val <= 255) - g_value_set_uchar(value, (guchar) val); - else - return -1; + if (PYGLIB_PyLong_Check(obj)) { + glong val; + val = PYGLIB_PyLong_AsLong(obj); + if (val >= 0 && val <= 255) + g_value_set_uchar(value, (guchar) val); + else + return -1; #if PY_VERSION_HEX < 0x03000000 - } else if (PyString_Check(obj)) { - g_value_set_uchar(value, PyString_AsString(obj)[0]); + } else if (PyString_Check(obj)) { + g_value_set_uchar(value, PyString_AsString(obj)[0]); #endif - } else if (PyUnicode_Check(obj)) { - tmp = PyUnicode_AsUTF8String(obj); - g_value_set_uchar(value, PYGLIB_PyBytes_AsString(tmp)[0]); - Py_DECREF(tmp); - } else { - PyErr_Clear(); - return -1; - } - break; + } else if (PyUnicode_Check(obj)) { + tmp = PyUnicode_AsUTF8String(obj); + g_value_set_uchar(value, PYGLIB_PyBytes_AsString(tmp)[0]); + Py_DECREF(tmp); + } else { + PyErr_Clear(); + return -1; + } + break; case G_TYPE_BOOLEAN: - g_value_set_boolean(value, PyObject_IsTrue(obj)); - break; + g_value_set_boolean(value, PyObject_IsTrue(obj)); + break; case G_TYPE_INT: - g_value_set_int(value, PYGLIB_PyLong_AsLong(obj)); - break; + g_value_set_int(value, PYGLIB_PyLong_AsLong(obj)); + break; case G_TYPE_UINT: - { - if (PYGLIB_PyLong_Check(obj)) { - guint val; + { + if (PYGLIB_PyLong_Check(obj)) { + guint val; - /* check that number is not negative */ - if (PyLong_AsLongLong(obj) < 0) - return -1; + /* check that number is not negative */ + if (PyLong_AsLongLong(obj) < 0) + return -1; - val = PyLong_AsUnsignedLong(obj); - if (val <= G_MAXUINT) - g_value_set_uint(value, val); - else - return -1; - } else { - g_value_set_uint(value, PyLong_AsUnsignedLong(obj)); - } - } - break; + val = PyLong_AsUnsignedLong(obj); + if (val <= G_MAXUINT) + g_value_set_uint(value, val); + else + return -1; + } else { + g_value_set_uint(value, PyLong_AsUnsignedLong(obj)); + } + } + break; case G_TYPE_LONG: - g_value_set_long(value, PYGLIB_PyLong_AsLong(obj)); - break; + g_value_set_long(value, PYGLIB_PyLong_AsLong(obj)); + break; case G_TYPE_ULONG: #if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(obj)) { + if (PyInt_Check(obj)) { long val; val = PYGLIB_PyLong_AsLong(obj); @@ -908,14 +911,14 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj) g_value_set_ulong(value, (gulong)val); } else #endif - if (PyLong_Check(obj)) - g_value_set_ulong(value, PyLong_AsUnsignedLong(obj)); - else - return -1; + if (PyLong_Check(obj)) + g_value_set_ulong(value, PyLong_AsUnsignedLong(obj)); + else + return -1; break; case G_TYPE_INT64: - g_value_set_int64(value, PyLong_AsLongLong(obj)); - break; + g_value_set_int64(value, PyLong_AsLongLong(obj)); + break; case G_TYPE_UINT64: #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(obj)) { @@ -927,173 +930,209 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj) g_value_set_uint64(value, v); } else #endif - if (PyLong_Check(obj)) - g_value_set_uint64(value, PyLong_AsUnsignedLongLong(obj)); - else - return -1; - break; + if (PyLong_Check(obj)) + g_value_set_uint64(value, PyLong_AsUnsignedLongLong(obj)); + else + return -1; + break; case G_TYPE_ENUM: - { - gint val = 0; - if (pyg_enum_get_value(G_VALUE_TYPE(value), obj, &val) < 0) { - PyErr_Clear(); - return -1; - } - g_value_set_enum(value, val); - } - break; + { + gint val = 0; + if (pyg_enum_get_value(G_VALUE_TYPE(value), obj, &val) < 0) { + return -1; + } + g_value_set_enum(value, val); + } + break; case G_TYPE_FLAGS: - { - guint val = 0; - if (pyg_flags_get_value(G_VALUE_TYPE(value), obj, &val) < 0) { - PyErr_Clear(); - return -1; - } - g_value_set_flags(value, val); - } - break; + { + guint val = 0; + if (pyg_flags_get_value(G_VALUE_TYPE(value), obj, &val) < 0) { + return -1; + } + g_value_set_flags(value, val); + } + break; case G_TYPE_FLOAT: - g_value_set_float(value, PyFloat_AsDouble(obj)); - break; + g_value_set_float(value, PyFloat_AsDouble(obj)); + break; case G_TYPE_DOUBLE: - g_value_set_double(value, PyFloat_AsDouble(obj)); - break; + g_value_set_double(value, PyFloat_AsDouble(obj)); + break; case G_TYPE_STRING: - if (obj == Py_None) { - g_value_set_string(value, NULL); - } else { - PyObject* tmp_str = PyObject_Str(obj); - if (tmp_str == NULL) { - PyErr_Clear(); - if (PyUnicode_Check(obj)) { - tmp = PyUnicode_AsUTF8String(obj); - g_value_set_string(value, PYGLIB_PyBytes_AsString(tmp)); - Py_DECREF(tmp); - } else { - return -1; - } - } else { + if (obj == Py_None) { + g_value_set_string(value, NULL); + } else { + PyObject* tmp_str = PyObject_Str(obj); + if (tmp_str == NULL) { + PyErr_Clear(); + if (PyUnicode_Check(obj)) { + tmp = PyUnicode_AsUTF8String(obj); + g_value_set_string(value, PYGLIB_PyBytes_AsString(tmp)); + Py_DECREF(tmp); + } else { + PyErr_SetString(PyExc_TypeError, "Expected string"); + return -1; + } + } else { #if PY_VERSION_HEX < 0x03000000 - g_value_set_string(value, PyString_AsString(tmp_str)); + g_value_set_string(value, PyString_AsString(tmp_str)); #else - tmp = PyUnicode_AsUTF8String(tmp_str); - g_value_set_string(value, PyBytes_AsString(tmp)); - Py_DECREF(tmp); + tmp = PyUnicode_AsUTF8String(tmp_str); + g_value_set_string(value, PyBytes_AsString(tmp)); + Py_DECREF(tmp); #endif - } - Py_XDECREF(tmp_str); - } - break; + } + Py_XDECREF(tmp_str); + } + break; case G_TYPE_POINTER: - if (obj == Py_None) - g_value_set_pointer(value, NULL); - else if (PyObject_TypeCheck(obj, &PyGPointer_Type) && - G_VALUE_HOLDS(value, ((PyGPointer *)obj)->gtype)) - g_value_set_pointer(value, pyg_pointer_get(obj, gpointer)); - else if (PYGLIB_CPointer_Check(obj)) - g_value_set_pointer(value, PYGLIB_CPointer_GetPointer(obj, NULL)); - else if (G_VALUE_HOLDS_GTYPE (value)) - g_value_set_gtype (value, pyg_type_from_object (obj)); - else - return -1; - break; + if (obj == Py_None) + g_value_set_pointer(value, NULL); + else if (PyObject_TypeCheck(obj, &PyGPointer_Type) && + G_VALUE_HOLDS(value, ((PyGPointer *)obj)->gtype)) + g_value_set_pointer(value, pyg_pointer_get(obj, gpointer)); + else if (PYGLIB_CPointer_Check(obj)) + g_value_set_pointer(value, PYGLIB_CPointer_GetPointer(obj, NULL)); + else if (G_VALUE_HOLDS_GTYPE (value)) + g_value_set_gtype (value, pyg_type_from_object (obj)); + else { + PyErr_SetString(PyExc_TypeError, "Expected pointer"); + return -1; + } + break; case G_TYPE_BOXED: { - PyGTypeMarshal *bm; - - if (obj == Py_None) - g_value_set_boxed(value, NULL); - else if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) - g_value_set_boxed(value, obj); - else if (PyObject_TypeCheck(obj, &PyGBoxed_Type) && - G_VALUE_HOLDS(value, ((PyGBoxed *)obj)->gtype)) - g_value_set_boxed(value, pyg_boxed_get(obj, gpointer)); + PyGTypeMarshal *bm; + + if (obj == Py_None) + g_value_set_boxed(value, NULL); + else if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) + g_value_set_boxed(value, obj); + else if (PyObject_TypeCheck(obj, &PyGBoxed_Type) && + G_VALUE_HOLDS(value, ((PyGBoxed *)obj)->gtype)) + g_value_set_boxed(value, pyg_boxed_get(obj, gpointer)); else if (G_VALUE_HOLDS(value, G_TYPE_VALUE)) { GType type; GValue *n_value; type = pyg_type_from_object((PyObject*)Py_TYPE(obj)); if (G_UNLIKELY (! type)) { - PyErr_Clear(); return -1; } n_value = g_new0 (GValue, 1); g_value_init (n_value, type); g_value_take_boxed (value, n_value); - return pyg_value_from_pyobject (n_value, obj); + return pyg_value_from_pyobject_with_error (n_value, obj); } else if (PySequence_Check(obj) && - G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY)) - return pyg_value_array_from_pyobject(value, obj, NULL); + G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY)) + return pyg_value_array_from_pyobject(value, obj, NULL); else if (PySequence_Check(obj) && - G_VALUE_HOLDS(value, G_TYPE_ARRAY)) - return pyg_array_from_pyobject(value, obj); - else if (PYGLIB_PyUnicode_Check(obj) && - G_VALUE_HOLDS(value, G_TYPE_GSTRING)) { + G_VALUE_HOLDS(value, G_TYPE_ARRAY)) + return pyg_array_from_pyobject(value, obj); + else if (PYGLIB_PyUnicode_Check(obj) && + G_VALUE_HOLDS(value, G_TYPE_GSTRING)) { GString *string; char *buffer; Py_ssize_t len; if (PYGLIB_PyUnicode_AsStringAndSize(obj, &buffer, &len)) return -1; string = g_string_new_len(buffer, len); - g_value_set_boxed(value, string); - g_string_free (string, TRUE); + g_value_set_boxed(value, string); + g_string_free (string, TRUE); break; } - else if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) - return bm->tovalue(value, obj); - else if (PYGLIB_CPointer_Check(obj)) - g_value_set_boxed(value, PYGLIB_CPointer_GetPointer(obj, NULL)); - else - return -1; - break; + else if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) + return bm->tovalue(value, obj); + else if (PYGLIB_CPointer_Check(obj)) + g_value_set_boxed(value, PYGLIB_CPointer_GetPointer(obj, NULL)); + else { + PyErr_SetString(PyExc_TypeError, "Expected Boxed"); + return -1; + } + break; } case G_TYPE_PARAM: /* we need to support both the wrapped _gobject.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))); + g_value_set_param(value, G_PARAM_SPEC (pygobject_get (obj))); else if (PyGParamSpec_Check(obj)) - g_value_set_param(value, PYGLIB_CPointer_GetPointer(obj, NULL)); - else - return -1; - break; + g_value_set_param(value, PYGLIB_CPointer_GetPointer(obj, NULL)); + else { + PyErr_SetString(PyExc_TypeError, "Expected ParamSpec"); + return -1; + } + break; case G_TYPE_OBJECT: - if (obj == Py_None) { - g_value_set_object(value, NULL); - } else if (PyObject_TypeCheck(obj, &PyGObject_Type) && - G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), - G_VALUE_TYPE(value))) { - g_value_set_object(value, pygobject_get(obj)); - } else - return -1; - break; + if (obj == Py_None) { + g_value_set_object(value, NULL); + } else if (PyObject_TypeCheck(obj, &PyGObject_Type) && + G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), + G_VALUE_TYPE(value))) { + g_value_set_object(value, pygobject_get(obj)); + } else { + PyErr_SetString(PyExc_TypeError, "Expected GObject"); + return -1; + } + break; case G_TYPE_VARIANT: - { - if (obj == Py_None) - g_value_set_variant(value, NULL); - else if (pyg_type_from_object_strict(obj, FALSE) == G_TYPE_VARIANT) - g_value_set_variant(value, pyg_boxed_get(obj, GVariant)); - else - return -1; - break; + { + if (obj == Py_None) + g_value_set_variant(value, NULL); + else if (pyg_type_from_object_strict(obj, FALSE) == G_TYPE_VARIANT) + g_value_set_variant(value, pyg_boxed_get(obj, GVariant)); + else { + PyErr_SetString(PyExc_TypeError, "Expected Variant"); + return -1; } + break; + } default: - { - PyGTypeMarshal *bm; - if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) - return bm->tovalue(value, obj); - break; - } + { + PyGTypeMarshal *bm; + if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) { + return bm->tovalue(value, obj); + } else { + PyErr_SetString(PyExc_TypeError, "Unknown value type"); + return -1; + } + break; } + } + + /* If an error occurred, unset the GValue but don't clear the Python error. */ if (PyErr_Occurred()) { g_value_unset(value); - PyErr_Clear(); return -1; } + return 0; } /** + * pyg_value_from_pyobject: + * @value: the GValue object to store the converted value in. + * @obj: the Python object to convert. + * + * Same basic function as pyg_value_from_pyobject_with_error but clears + * any Python errors before returning. + * + * Returns: 0 on success, -1 on error. + */ +int +pyg_value_from_pyobject(GValue *value, PyObject *obj) +{ + int res = pyg_value_from_pyobject_with_error (value, obj); + + if (PyErr_Occurred()) { + PyErr_Clear(); + return -1; + } + return res; +} + +/** * pyg_value_as_pyobject: * @value: the GValue object. * @copy_boxed: true if boxed values should be copied. @@ -1110,148 +1149,148 @@ pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed) switch (G_TYPE_FUNDAMENTAL(G_VALUE_TYPE(value))) { case G_TYPE_INTERFACE: - if (g_type_is_a(G_VALUE_TYPE(value), G_TYPE_OBJECT)) - return pygobject_new(g_value_get_object(value)); - else - break; + if (g_type_is_a(G_VALUE_TYPE(value), G_TYPE_OBJECT)) + return pygobject_new(g_value_get_object(value)); + else + break; case G_TYPE_CHAR: { - gint8 val = g_value_get_schar(value); - return PYGLIB_PyUnicode_FromStringAndSize((char *)&val, 1); + gint8 val = g_value_get_schar(value); + return PYGLIB_PyUnicode_FromStringAndSize((char *)&val, 1); } case G_TYPE_UCHAR: { - guint8 val = g_value_get_uchar(value); - return PYGLIB_PyBytes_FromStringAndSize((char *)&val, 1); + guint8 val = g_value_get_uchar(value); + return PYGLIB_PyBytes_FromStringAndSize((char *)&val, 1); } case G_TYPE_BOOLEAN: { - return PyBool_FromLong(g_value_get_boolean(value)); + return PyBool_FromLong(g_value_get_boolean(value)); } case G_TYPE_INT: - return PYGLIB_PyLong_FromLong(g_value_get_int(value)); + return PYGLIB_PyLong_FromLong(g_value_get_int(value)); case G_TYPE_UINT: - { - /* in Python, the Int object is backed by a long. If a + { + /* in Python, the Int object is backed by a long. If a long can hold the whole value of an unsigned int, use an Int. Otherwise, use a Long object to avoid overflow. This matches the ULongArg behavior in codegen/argtypes.h */ #if (G_MAXUINT <= G_MAXLONG) - return PYGLIB_PyLong_FromLong((glong) g_value_get_uint(value)); + return PYGLIB_PyLong_FromLong((glong) g_value_get_uint(value)); #else - return PyLong_FromUnsignedLong((gulong) g_value_get_uint(value)); + return PyLong_FromUnsignedLong((gulong) g_value_get_uint(value)); #endif - } + } case G_TYPE_LONG: - return PYGLIB_PyLong_FromLong(g_value_get_long(value)); + return PYGLIB_PyLong_FromLong(g_value_get_long(value)); case G_TYPE_ULONG: - { - gulong val = g_value_get_ulong(value); + { + gulong val = g_value_get_ulong(value); - if (val <= G_MAXLONG) - return PYGLIB_PyLong_FromLong((glong) val); - else - return PyLong_FromUnsignedLong(val); - } + if (val <= G_MAXLONG) + return PYGLIB_PyLong_FromLong((glong) val); + else + return PyLong_FromUnsignedLong(val); + } case G_TYPE_INT64: - { - gint64 val = g_value_get_int64(value); + { + gint64 val = g_value_get_int64(value); - if (G_MINLONG <= val && val <= G_MAXLONG) - return PYGLIB_PyLong_FromLong((glong) val); - else - return PyLong_FromLongLong(val); - } + if (G_MINLONG <= val && val <= G_MAXLONG) + return PYGLIB_PyLong_FromLong((glong) val); + else + return PyLong_FromLongLong(val); + } case G_TYPE_UINT64: - { - guint64 val = g_value_get_uint64(value); + { + guint64 val = g_value_get_uint64(value); - if (val <= G_MAXLONG) - return PYGLIB_PyLong_FromLong((glong) val); - else - return PyLong_FromUnsignedLongLong(val); - } + if (val <= G_MAXLONG) + return PYGLIB_PyLong_FromLong((glong) val); + else + return PyLong_FromUnsignedLongLong(val); + } case G_TYPE_ENUM: - return pyg_enum_from_gtype(G_VALUE_TYPE(value), g_value_get_enum(value)); + return pyg_enum_from_gtype(G_VALUE_TYPE(value), g_value_get_enum(value)); case G_TYPE_FLAGS: - return pyg_flags_from_gtype(G_VALUE_TYPE(value), g_value_get_flags(value)); + return pyg_flags_from_gtype(G_VALUE_TYPE(value), g_value_get_flags(value)); case G_TYPE_FLOAT: - return PyFloat_FromDouble(g_value_get_float(value)); + return PyFloat_FromDouble(g_value_get_float(value)); case G_TYPE_DOUBLE: - return PyFloat_FromDouble(g_value_get_double(value)); + return PyFloat_FromDouble(g_value_get_double(value)); case G_TYPE_STRING: - { - const gchar *str = g_value_get_string(value); + { + const gchar *str = g_value_get_string(value); - if (str) - return PYGLIB_PyUnicode_FromString(str); - Py_INCREF(Py_None); - return Py_None; - } + if (str) + return PYGLIB_PyUnicode_FromString(str); + Py_INCREF(Py_None); + return Py_None; + } case G_TYPE_POINTER: - if (G_VALUE_HOLDS_GTYPE (value)) - return pyg_type_wrapper_new (g_value_get_gtype (value)); - else - return pyg_pointer_new(G_VALUE_TYPE(value), - g_value_get_pointer(value)); + if (G_VALUE_HOLDS_GTYPE (value)) + return pyg_type_wrapper_new (g_value_get_gtype (value)); + else + return pyg_pointer_new(G_VALUE_TYPE(value), + g_value_get_pointer(value)); case G_TYPE_BOXED: { - PyGTypeMarshal *bm; + PyGTypeMarshal *bm; - if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) { - PyObject *ret = (PyObject *)g_value_dup_boxed(value); - if (ret == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return ret; + if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) { + PyObject *ret = (PyObject *)g_value_dup_boxed(value); + if (ret == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + return ret; } else if (G_VALUE_HOLDS(value, G_TYPE_VALUE)) { GValue *n_value = g_value_get_boxed (value); return pyg_value_as_pyobject(n_value, copy_boxed); } else if (G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY)) { - GValueArray *array = (GValueArray *) g_value_get_boxed(value); - PyObject *ret = PyList_New(array->n_values); - int i; - for (i = 0; i < array->n_values; ++i) - PyList_SET_ITEM(ret, i, pyg_value_as_pyobject - (array->values + i, copy_boxed)); - return ret; - } else if (G_VALUE_HOLDS(value, G_TYPE_GSTRING)) { - GString *string = (GString *) g_value_get_boxed(value); - PyObject *ret = PYGLIB_PyUnicode_FromStringAndSize(string->str, string->len); - return ret; - } - bm = pyg_type_lookup(G_VALUE_TYPE(value)); - if (bm) { - return bm->fromvalue(value); - } else { - if (copy_boxed) - return pyg_boxed_new(G_VALUE_TYPE(value), - g_value_get_boxed(value), TRUE, TRUE); - else - return pyg_boxed_new(G_VALUE_TYPE(value), - g_value_get_boxed(value),FALSE,FALSE); - } + GValueArray *array = (GValueArray *) g_value_get_boxed(value); + PyObject *ret = PyList_New(array->n_values); + int i; + for (i = 0; i < array->n_values; ++i) + PyList_SET_ITEM(ret, i, pyg_value_as_pyobject + (array->values + i, copy_boxed)); + return ret; + } else if (G_VALUE_HOLDS(value, G_TYPE_GSTRING)) { + GString *string = (GString *) g_value_get_boxed(value); + PyObject *ret = PYGLIB_PyUnicode_FromStringAndSize(string->str, string->len); + return ret; + } + bm = pyg_type_lookup(G_VALUE_TYPE(value)); + if (bm) { + return bm->fromvalue(value); + } else { + if (copy_boxed) + return pyg_boxed_new(G_VALUE_TYPE(value), + g_value_get_boxed(value), TRUE, TRUE); + else + return pyg_boxed_new(G_VALUE_TYPE(value), + g_value_get_boxed(value),FALSE,FALSE); + } } case G_TYPE_PARAM: - return pyg_param_spec_new(g_value_get_param(value)); + return pyg_param_spec_new(g_value_get_param(value)); case G_TYPE_OBJECT: - return pygobject_new(g_value_get_object(value)); + return pygobject_new(g_value_get_object(value)); case G_TYPE_VARIANT: - { - GVariant *v = g_value_get_variant(value); - if (v == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return pyg_boxed_new(G_TYPE_VARIANT, g_variant_ref(v), FALSE, FALSE); + { + GVariant *v = g_value_get_variant(value); + if (v == NULL) { + Py_INCREF(Py_None); + return Py_None; } + return pyg_boxed_new(G_TYPE_VARIANT, g_variant_ref(v), FALSE, FALSE); + } default: - { - PyGTypeMarshal *bm; - if ((bm = pyg_type_lookup(G_VALUE_TYPE(value)))) - return bm->fromvalue(value); - break; - } + { + PyGTypeMarshal *bm; + if ((bm = pyg_type_lookup(G_VALUE_TYPE(value)))) + return bm->fromvalue(value); + break; + } } g_snprintf(buf, sizeof(buf), "unknown type %s", - g_type_name(G_VALUE_TYPE(value))); + g_type_name(G_VALUE_TYPE(value))); PyErr_SetString(PyExc_TypeError, buf); return NULL; } diff --git a/gi/docstring.py b/gi/docstring.py new file mode 100644 index 0000000..713bb6e --- /dev/null +++ b/gi/docstring.py @@ -0,0 +1,106 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2013 Simon Feltman <sfeltman@gnome.org> +# +# docstring.py: documentation string generator for gi. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +from ._gi import \ + VFuncInfo, \ + FunctionInfo, \ + DIRECTION_IN, \ + DIRECTION_OUT, \ + DIRECTION_INOUT + + +#: Module storage for currently registered doc string generator function. +_generate_doc_string_func = None + + +def set_doc_string_generator(func): + """Set doc string generator function + + :Parameters: + func : callable + Function which takes a GIInfoStruct and returns + documentation for it. + """ + global _generate_doc_string_func + _generate_doc_string_func = func + + +def get_doc_string_generator(): + return _generate_doc_string_func + + +def generate_doc_string(info): + """Generator a doc string given a GIInfoStruct + + This passes the info struct to the currently registered doc string + generator and returns the result. + """ + return _generate_doc_string_func(info) + + +def split_function_info_args(info): + """Split a functions args into a tuple of two lists. + + Note that args marked as DIRECTION_INOUT will be in both lists. + + :Returns: + Tuple of (in_args, out_args) + """ + in_args = [] + out_args = [] + for arg in info.get_arguments(): + direction = arg.get_direction() + if direction in (DIRECTION_IN, DIRECTION_INOUT): + in_args.append(arg) + if direction in (DIRECTION_OUT, DIRECTION_INOUT): + out_args.append(arg) + return (in_args, out_args) + + +def _generate_callable_info_function_signature(info): + """Default doc string generator""" + in_args, out_args = split_function_info_args(info) + in_args_strs = [] + if isinstance(info, VFuncInfo): + in_args_strs = ['self'] + elif isinstance(info, FunctionInfo): + if info.is_method(): + in_args_strs = ['self'] + elif info.is_constructor(): + in_args_strs = ['cls'] + + for arg in in_args: + argstr = arg.get_name() + ':' + arg.get_pytype_hint() + if arg.is_optional(): + argstr += '=<optional>' + in_args_strs.append(argstr) + in_args_str = ', '.join(in_args_strs) + + if out_args: + out_args_str = ', '.join(arg.get_name() + ':' + arg.get_pytype_hint() + for arg in out_args) + return '%s(%s) -> %s' % (info.get_name(), in_args_str, out_args_str) + else: + return '%s(%s)' % (info.get_name(), in_args_str) + + +set_doc_string_generator(_generate_callable_info_function_signature) diff --git a/gi/gimodule.c b/gi/gimodule.c index 5b6bc14..12dfb36 100644 --- a/gi/gimodule.c +++ b/gi/gimodule.c @@ -28,6 +28,8 @@ #include <pygobject.h> #include <pyglib-python-compat.h> +PyObject *PyGIDeprecationWarning; + static PyObject * _wrap_pyg_enum_add (PyObject *self, PyObject *args, @@ -641,6 +643,22 @@ PYGLIB_MODULE_START(_gi, "_gi") _pygi_ccallback_register_types (module); _pygi_argument_init(); + /* Use RuntimeWarning as the base class of PyGIDeprecationWarning + * for unstable (odd minor version) and use DeprecationWarning for + * stable (even minor version). This is so PyGObject deprecations + * behave the same as regular Python deprecations in stable releases. + */ +#if PYGOBJECT_MINOR_VERSION % 2 + PyGIDeprecationWarning = PyErr_NewException("gi.PyGIDeprecationWarning", + PyExc_RuntimeWarning, NULL); +#else + PyGIDeprecationWarning = PyErr_NewException("gi.PyGIDeprecationWarning", + PyExc_DeprecationWarning, NULL); +#endif + + Py_INCREF(PyGIDeprecationWarning); + PyModule_AddObject(module, "PyGIDeprecationWarning", PyGIDeprecationWarning); + api = PYGLIB_CPointer_WrapPointer ( (void *) &CAPI, "gi._API"); if (api == NULL) { return PYGLIB_MODULE_ERROR_RETURN; diff --git a/gi/module.py b/gi/module.py index dd0a90a..71f8ac5 100644 --- a/gi/module.py +++ b/gi/module.py @@ -24,6 +24,7 @@ from __future__ import absolute_import import sys import types +import importlib _have_py3 = (sys.version_info[0] >= 3) @@ -56,8 +57,7 @@ from ._gi import \ flags_register_new_gtype_and_add from .types import \ GObjectMeta, \ - StructMeta, \ - Function + StructMeta from ._gobject._gobject import \ GInterface, \ @@ -90,7 +90,7 @@ def get_parent_for_object(object_info): namespace = parent_object_info.get_namespace() name = parent_object_info.get_name() - module = __import__('gi.repository.%s' % namespace, fromlist=[name]) + module = importlib.import_module('gi.repository.' + namespace) return getattr(module, name) @@ -100,7 +100,7 @@ def get_interfaces_for_object(object_info): namespace = interface_info.get_namespace() name = interface_info.get_name() - module = __import__('gi.repository.%s' % namespace, fromlist=[name]) + module = importlib.import_module('gi.repository.' + namespace) interfaces.append(getattr(module, name)) return interfaces @@ -207,7 +207,6 @@ class IntrospectionModule(object): self.__dict__[name] = type_ return type_ - name = info.get_name() dict_ = { '__info__': info, '__module__': 'gi.repository.' + self._namespace, @@ -220,7 +219,7 @@ class IntrospectionModule(object): g_type.pytype = wrapper elif isinstance(info, FunctionInfo): - wrapper = Function(info) + wrapper = info elif isinstance(info, ConstantInfo): wrapper = info.get_value() else: @@ -287,8 +286,7 @@ class DynamicModule(types.ModuleType): def _load(self): self._introspection_module = get_introspection_module(self._namespace) try: - overrides_modules = __import__('gi.overrides', fromlist=[self._namespace]) - self._overrides_module = getattr(overrides_modules, self._namespace, None) + self._overrides_module = importlib.import_module('gi.overrides.' + self._namespace) except ImportError: self._overrides_module = None diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py index 7c512ca..0a4cdb6 100644 --- a/gi/overrides/GLib.py +++ b/gi/overrides/GLib.py @@ -48,7 +48,7 @@ spawn_async = _glib.spawn_async def threads_init(): - warnings.warn('threads_init longer needs to be called. ' + warnings.warn('threads_init no longer needs to be called. ' 'See: https://bugzilla.gnome.org/show_bug.cgi?id=686914', PyGIDeprecationWarning) diff --git a/gi/overrides/GObject.py b/gi/overrides/GObject.py index 42c97a2..044c36e 100644 --- a/gi/overrides/GObject.py +++ b/gi/overrides/GObject.py @@ -219,6 +219,15 @@ class Value(GObjectModule.Value): if self._free_on_dealloc and self.g_type != TYPE_INVALID: self.unset() + def set_boxed(self, boxed): + # 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) + + def get_boxed(self): + return _gobject._gvalue_get(self) + def set_value(self, py_value): gtype = self.g_type @@ -448,8 +457,8 @@ def signal_handler_block(obj, handler_id): Returns a context manager which optionally can be used to automatically unblock the handler: - >>> with GObject.signal_handler_block(obj, id): - >>> pass + with GObject.signal_handler_block(obj, id): + pass """ GObjectModule.signal_handler_block(_get_instance_for_signal(obj), handler_id) return _HandlerBlockManager(obj, handler_id) @@ -616,8 +625,8 @@ class Object(GObjectModule.Object): Returns a context manager which optionally can be used to automatically thaw notifications: - >>> with obj.freeze_notify(): - >>> pass + with obj.freeze_notify(): + pass """ super(Object, self).freeze_notify() return _FreezeNotifyManager(self) diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py index 9a6e1a3..5899596 100644 --- a/gi/overrides/Gtk.py +++ b/gi/overrides/Gtk.py @@ -19,6 +19,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA +import collections import sys from gi.repository import GObject from ..overrides import override, strip_boolean_result @@ -357,32 +358,52 @@ __all__.append('MenuItem') class Builder(Gtk.Builder): + @staticmethod + def _extract_handler_and_args(obj_or_map, handler_name): + handler = None + if isinstance(obj_or_map, collections.Mapping): + handler = obj_or_map.get(handler_name, None) + else: + handler = getattr(obj_or_map, handler_name, None) - def connect_signals(self, obj_or_map): - def _full_callback(builder, gobj, signal_name, handler_name, connect_obj, flags, obj_or_map): - handler = None - if isinstance(obj_or_map, dict): - handler = obj_or_map.get(handler_name, None) - else: - handler = getattr(obj_or_map, handler_name, None) + if handler is None: + raise AttributeError('Handler %s not found' % handler_name) + + args = () + if isinstance(handler, collections.Sequence): + if len(handler) == 0: + raise TypeError("Handler %s tuple can not be empty" % handler) + args = handler[1:] + handler = handler[0] - if handler is None: - raise AttributeError('Handler %s not found' % handler_name) + elif not _callable(handler): + raise TypeError('Handler %s is not a method, function or tuple' % handler) - if not _callable(handler): - raise TypeError('Handler %s is not a method or function' % handler_name) + return handler, args + + def connect_signals(self, obj_or_map): + """Connect signals specified by this builder to a name, handler mapping. + + Connect signal, name, and handler sets specified in the builder with + the given mapping "obj_or_map". The handler/value aspect of the mapping + can also contain a tuple in the form of (handler [,arg1 [,argN]]) + allowing for extra arguments to be passed to the handler. For example: + builder.connect_signals({'on_clicked': (on_clicked, arg1, arg2)}) + """ + def _full_callback(builder, gobj, signal_name, handler_name, connect_obj, flags, obj_or_map): + handler, args = self._extract_handler_and_args(obj_or_map, handler_name) after = flags & GObject.ConnectFlags.AFTER if connect_obj is not None: if after: - gobj.connect_object_after(signal_name, handler, connect_obj) + gobj.connect_object_after(signal_name, handler, connect_obj, *args) else: - gobj.connect_object(signal_name, handler, connect_obj) + gobj.connect_object(signal_name, handler, connect_obj, *args) else: if after: - gobj.connect_after(signal_name, handler) + gobj.connect_after(signal_name, handler, *args) else: - gobj.connect(signal_name, handler) + gobj.connect(signal_name, handler, *args) self.connect_signals_full(_full_callback, obj_or_map) @@ -473,7 +494,7 @@ class Dialog(Gtk.Dialog, Container): pairs - button text (or stock ID) and a response ID integer are passed individually. For example: - >>> dialog.add_buttons(Gtk.STOCK_OPEN, 42, "Close", Gtk.ResponseType.CLOSE) + dialog.add_buttons(Gtk.STOCK_OPEN, 42, "Close", Gtk.ResponseType.CLOSE) will add "Open" and "Close" buttons to dialog. """ diff --git a/gi/overrides/Makefile.in b/gi/overrides/Makefile.in index 2d5e808..740b945 100644 --- a/gi/overrides/Makefile.in +++ b/gi/overrides/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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. @@ -15,23 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + 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@ @@ -51,8 +78,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = gi/overrides -DIST_COMMON = $(pygioverrides_PYTHON) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(pygioverrides_PYTHON) $(top_srcdir)/py-compile 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 \ @@ -65,12 +92,18 @@ 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_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 = \ @@ -107,7 +140,10 @@ am__uninstall_files_from_dir = { \ } am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) am__installdirs = "$(DESTDIR)$(pygioverridesdir)" +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) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ @@ -346,32 +382,38 @@ install-pygioverridesPYTHON: $(pygioverrides_PYTHON) $(INSTALL_DATA) $$files "$(DESTDIR)$(pygioverridesdir)" || exit $$?; \ done || exit $$?; \ if test -n "$$dlist"; then \ - if test -z "$(DESTDIR)"; then \ - $(am__py_compile) --basedir "$(pygioverridesdir)" $$dlist; \ - else \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygioverridesdir)" $$dlist; \ - fi; \ + $(am__py_compile) --destdir "$(DESTDIR)" \ + --basedir "$(pygioverridesdir)" $$dlist; \ else :; fi uninstall-pygioverridesPYTHON: @$(NORMAL_UNINSTALL) @list='$(pygioverrides_PYTHON)'; test -n "$(pygioverridesdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ + py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$py_files" || exit 0; \ dir='$(DESTDIR)$(pygioverridesdir)'; \ - filesc=`echo "$$files" | sed 's|$$|c|'`; \ - fileso=`echo "$$files" | sed 's|$$|o|'`; \ + 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 "$$files" "$$filesc" "$$fileso"; do \ + 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 -TAGS: +tags TAGS: + +ctags CTAGS: -ctags: CTAGS -CTAGS: +cscope cscopelist: distdir: $(DISTFILES) @@ -511,17 +553,17 @@ uninstall-am: uninstall-pygioverridesPYTHON .MAKE: check-am install-am install-strip .PHONY: all all-am all-local check check-am check-local clean \ - clean-generic clean-libtool 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-pygioverridesPYTHON install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-pygioverridesPYTHON + 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-pygioverridesPYTHON \ + 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-pygioverridesPYTHON # if we build in a separate tree, we need to symlink the *.py files from the diff --git a/gi/overrides/__init__.py b/gi/overrides/__init__.py index 99cb152..943ea60 100644 --- a/gi/overrides/__init__.py +++ b/gi/overrides/__init__.py @@ -3,6 +3,7 @@ import warnings import functools from gi import PyGIDeprecationWarning +from gi._gi import CallableInfo from gi._gobject.constants import \ TYPE_NONE, \ TYPE_INVALID @@ -33,7 +34,8 @@ class _Registry(dict): raise TypeError('Can not override a type %s, which is not in a gobject introspection typelib' % value.__name__) if not value.__module__.startswith('gi.overrides'): - raise KeyError('You have tried to modify the registry outside of the overrides module. This is not allowed') + raise KeyError('You have tried to modify the registry outside of the overrides module. ' + 'This is not allowed (%s, %s)' % (value, value.__module__)) g_type = info.get_g_type() assert g_type != TYPE_NONE @@ -52,8 +54,8 @@ class _Registry(dict): class overridefunc(object): '''decorator for overriding a function''' def __init__(self, func): - if not hasattr(func, '__info__'): - raise TypeError("func must be an gi function") + if not isinstance(func, CallableInfo): + raise TypeError("func must be a gi function, got %s" % func) from ..importer import modules module_name = func.__module__.rsplit('.', 1)[-1] self.module = modules[module_name]._introspection_module @@ -70,7 +72,7 @@ registry = _Registry() def override(type_): '''Decorator for registering an override''' - if isinstance(type_, types.FunctionType): + if isinstance(type_, (types.FunctionType, CallableInfo)): return overridefunc(type_) else: registry.register(type_) diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c index f477fdf..7d8a837 100644 --- a/gi/pygi-argument.c +++ b/gi/pygi-argument.c @@ -898,141 +898,12 @@ _pygi_argument_from_object (PyObject *object, memset(&arg, 0, sizeof(GIArgument)); type_tag = g_type_info_get_tag (type_info); - switch (type_tag) { - case GI_TYPE_TAG_VOID: - g_warn_if_fail (transfer == GI_TRANSFER_NOTHING); - if (object == Py_None) { - arg.v_pointer = NULL; - } else if (!PYGLIB_PyLong_Check(object) && !PyLong_Check(object)) { - PyErr_SetString(PyExc_TypeError, - "Pointer assignment is restricted to integer values. " - "See: https://bugzilla.gnome.org/show_bug.cgi?id=683599"); - } else { - arg.v_pointer = PyLong_AsVoidPtr (object); - } - break; - case GI_TYPE_TAG_BOOLEAN: - { - arg.v_boolean = PyObject_IsTrue (object); - break; - } - case GI_TYPE_TAG_INT8: - case GI_TYPE_TAG_INT16: - case GI_TYPE_TAG_INT32: - { - PyObject *int_; - - int_ = PYGLIB_PyNumber_Long (object); - if (int_ == NULL) { - PyErr_SetString (PyExc_TypeError, "expected int argument"); - break; - } - - if (type_tag == GI_TYPE_TAG_INT32) - arg.v_int32 = PYGLIB_PyLong_AsLong (int_); - else if (type_tag == GI_TYPE_TAG_INT8) - arg.v_int8 = PYGLIB_PyLong_AsLong (int_); - else if (type_tag == GI_TYPE_TAG_INT16) - arg.v_int16 = PYGLIB_PyLong_AsLong (int_); - - Py_DECREF (int_); - - break; - } - case GI_TYPE_TAG_UINT8: - case GI_TYPE_TAG_UINT16: - case GI_TYPE_TAG_UINT32: - case GI_TYPE_TAG_UINT64: - { - PyObject *number; - guint64 value; - - number = PYGLIB_PyNumber_Long (object); - if (number == NULL) { - PyErr_SetString (PyExc_TypeError, "expected int argument"); - break; - } - -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check (number)) { - value = PyInt_AS_LONG (number); - } else -#endif - value = PyLong_AsUnsignedLongLong (number); - - if (type_tag == GI_TYPE_TAG_UINT32) - arg.v_uint32 = value; - else if (type_tag == GI_TYPE_TAG_UINT64) - arg.v_uint64 = value; - else if (type_tag == GI_TYPE_TAG_UINT8) - arg.v_uint8 = value; - else if (type_tag == GI_TYPE_TAG_UINT16) - arg.v_uint16 = value; - - Py_DECREF (number); - - break; - } - case GI_TYPE_TAG_INT64: - { - PyObject *number; - gint64 value; - - number = PYGLIB_PyNumber_Long (object); - if (number == NULL) { - PyErr_SetString (PyExc_TypeError, "expected int argument"); - break; - } - -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check (number)) { - value = PyInt_AS_LONG (number); - } else -#endif - value = PyLong_AsLongLong (number); - - arg.v_int64 = value; - - Py_DECREF (number); - - break; - } - case GI_TYPE_TAG_FLOAT: - { - _pygi_marshal_from_py_float (NULL, NULL, NULL, - object, &arg); - break; - } - case GI_TYPE_TAG_DOUBLE: - { - _pygi_marshal_from_py_double (NULL, NULL, NULL, - object, &arg); - break; - } - case GI_TYPE_TAG_GTYPE: - { - arg.v_long = pyg_type_from_object (object); + if (_pygi_marshal_from_py_basic_type (object, &arg, type_tag, transfer) || + PyErr_Occurred()) { + return arg; + } - break; - } - case GI_TYPE_TAG_UNICHAR: - { - _pygi_marshal_from_py_unichar (NULL, NULL, NULL, - object, &arg); - break; - } - case GI_TYPE_TAG_UTF8: - { - _pygi_marshal_from_py_utf8 (NULL, NULL, NULL, - object, &arg); - break; - } - case GI_TYPE_TAG_FILENAME: - { - _pygi_marshal_from_py_filename (NULL, NULL, NULL, - object, &arg); - break; - } + switch (type_tag) { case GI_TYPE_TAG_ARRAY: { Py_ssize_t length; @@ -1156,16 +1027,16 @@ array_success: * Further re-factoring is needed to fix this leak. * See: https://bugzilla.gnome.org/show_bug.cgi?id=693405 */ - pygi_marshal_from_py_interface_struct (object, - &arg, - NULL, /*arg_name*/ - info, /*interface_info*/ - type_info, - g_type, - py_type, - transfer, - FALSE, /*is_caller_allocates*/ - g_struct_info_is_foreign (info)); + _pygi_marshal_from_py_interface_struct (object, + &arg, + NULL, /*arg_name*/ + info, /*interface_info*/ + type_info, + g_type, + py_type, + transfer, + FALSE, /*copy_reference*/ + g_struct_info_is_foreign (info)); Py_DECREF (py_type); break; @@ -1189,7 +1060,7 @@ array_success: case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_OBJECT: /* An error within this call will result in a NULL arg */ - pygi_marshal_from_py_gobject (object, &arg, transfer); + _pygi_marshal_from_py_gobject_out_arg (object, &arg, transfer); break; default: @@ -1373,6 +1244,8 @@ hash_table_release: PyErr_SetString (PyExc_NotImplementedError, "error marshalling is not supported yet"); /* TODO */ break; + default: + g_assert_not_reached (); } return arg; @@ -1380,14 +1253,14 @@ hash_table_release: /** * _pygi_argument_to_object: - * @arg: The argument to convert to an object. + * @arg: The argument to convert to an object. * @type_info: Type info for @arg * @transfer: * * If the argument is of type array, it must be encoded in a GArray, by calling * _pygi_argument_to_array(). This logic can not be folded into this method * as determining array lengths may require access to method call arguments. - * + * * Returns: A PyObject representing @arg */ PyObject * @@ -1399,6 +1272,10 @@ _pygi_argument_to_object (GIArgument *arg, PyObject *object = NULL; type_tag = g_type_info_get_tag (type_info); + object = _pygi_marshal_to_py_basic_type (arg, type_tag, transfer); + if (object) + return object; + switch (type_tag) { case GI_TYPE_TAG_VOID: { @@ -1408,84 +1285,6 @@ _pygi_argument_to_object (GIArgument *arg, } break; } - case GI_TYPE_TAG_BOOLEAN: - { - object = PyBool_FromLong (arg->v_boolean); - break; - } - case GI_TYPE_TAG_INT8: - { - object = PYGLIB_PyLong_FromLong (arg->v_int8); - break; - } - case GI_TYPE_TAG_UINT8: - { - object = PYGLIB_PyLong_FromLong (arg->v_uint8); - break; - } - case GI_TYPE_TAG_INT16: - { - object = PYGLIB_PyLong_FromLong (arg->v_int16); - break; - } - case GI_TYPE_TAG_UINT16: - { - object = PYGLIB_PyLong_FromLong (arg->v_uint16); - break; - } - case GI_TYPE_TAG_INT32: - { - object = PYGLIB_PyLong_FromLong (arg->v_int32); - break; - } - case GI_TYPE_TAG_UINT32: - { - object = PyLong_FromLongLong (arg->v_uint32); - break; - } - case GI_TYPE_TAG_INT64: - { - object = PyLong_FromLongLong (arg->v_int64); - break; - } - case GI_TYPE_TAG_UINT64: - { - object = PyLong_FromUnsignedLongLong (arg->v_uint64); - break; - } - case GI_TYPE_TAG_FLOAT: - { - object = PyFloat_FromDouble (arg->v_float); - break; - } - case GI_TYPE_TAG_DOUBLE: - { - object = PyFloat_FromDouble (arg->v_double); - break; - } - case GI_TYPE_TAG_GTYPE: - { - object = pyg_type_wrapper_new ( (GType) arg->v_long); - break; - } - case GI_TYPE_TAG_UNICHAR: - { - object = _pygi_marshal_to_py_unichar (NULL, NULL, NULL, - arg); - break; - } - case GI_TYPE_TAG_UTF8: - { - object = _pygi_marshal_to_py_utf8 (NULL, NULL, NULL, - arg); - break; - } - case GI_TYPE_TAG_FILENAME: - { - object = _pygi_marshal_to_py_filename (NULL, NULL, NULL, - arg); - break; - } case GI_TYPE_TAG_ARRAY: { /* Arrays are assumed to be packed in a GArray */ @@ -1571,13 +1370,13 @@ _pygi_argument_to_object (GIArgument *arg, py_type = _pygi_type_get_from_g_type (g_type); } - object = pygi_marshal_to_py_interface_struct (arg, - info, /*interface_info*/ - g_type, - py_type, - transfer, - FALSE, /*is_allocated*/ - g_struct_info_is_foreign (info)); + object = _pygi_marshal_to_py_interface_struct (arg, + info, /*interface_info*/ + g_type, + py_type, + transfer, + FALSE, /*is_allocated*/ + g_struct_info_is_foreign (info)); Py_XDECREF (py_type); break; @@ -1634,10 +1433,10 @@ _pygi_argument_to_object (GIArgument *arg, transfer == GI_TRANSFER_NOTHING && g_object_is_floating (arg->v_pointer)) { g_object_ref (arg->v_pointer); - object = pygi_marshal_to_py_object (arg, GI_TRANSFER_EVERYTHING); + object = _pygi_marshal_to_py_object (arg, GI_TRANSFER_EVERYTHING); g_object_force_floating (arg->v_pointer); } else { - object = pygi_marshal_to_py_object (arg, transfer); + object = _pygi_marshal_to_py_object (arg, transfer); } break; @@ -1775,6 +1574,11 @@ _pygi_argument_to_object (GIArgument *arg, Py_INCREF (object); break; } + break; + } + default: + { + g_assert_not_reached(); } } @@ -1899,8 +1703,8 @@ _pygi_argument_from_g_value(const GValue *value, arg.v_pointer = g_value_get_boxed (value); break; case GI_TYPE_TAG_VOID: - g_critical("Converting of type '%s' is not implemented", g_type_tag_to_string(type_tag)); - g_assert_not_reached(); + arg.v_pointer = g_value_get_pointer (value); + break; } return arg; diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c index d149732..2f807f8 100644 --- a/gi/pygi-cache.c +++ b/gi/pygi-cache.c @@ -260,178 +260,34 @@ _arg_cache_alloc (void) } static void -_arg_cache_from_py_void_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_void; -} - -static void -_arg_cache_to_py_void_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_void; -} - -static void -_arg_cache_from_py_boolean_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_boolean; -} - -static void -_arg_cache_to_py_boolean_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_boolean; -} - -static void -_arg_cache_from_py_int8_setup (PyGIArgCache *arg_cache) +_arg_cache_from_py_basic_type_setup (PyGIArgCache *arg_cache) { - arg_cache->from_py_marshaller = _pygi_marshal_from_py_int8; + arg_cache->from_py_marshaller = _pygi_marshal_from_py_basic_type_cache_adapter; } static void -_arg_cache_to_py_int8_setup (PyGIArgCache *arg_cache) +_arg_cache_to_py_basic_type_setup (PyGIArgCache *arg_cache) { - arg_cache->to_py_marshaller = _pygi_marshal_to_py_int8; + arg_cache->to_py_marshaller = _pygi_marshal_to_py_basic_type_cache_adapter; } static void -_arg_cache_from_py_uint8_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_uint8; -} - -static void -_arg_cache_to_py_uint8_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_uint8; -} - -static void -_arg_cache_from_py_int16_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_int16; -} - -static void -_arg_cache_to_py_int16_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_int16; -} - -static void -_arg_cache_from_py_uint16_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_uint16; -} - -static void -_arg_cache_to_py_uint16_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_uint16; -} - -static void -_arg_cache_from_py_int32_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_int32; -} - -static void -_arg_cache_to_py_int32_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_int32; -} - -static void -_arg_cache_from_py_uint32_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_uint32; -} - -static void -_arg_cache_to_py_uint32_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_uint32; -} - -static void -_arg_cache_from_py_int64_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_int64; -} - -static void -_arg_cache_to_py_int64_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_int64; -} - -static void -_arg_cache_from_py_uint64_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_uint64; -} - -static void -_arg_cache_to_py_uint64_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_uint64; -} - -static void -_arg_cache_from_py_float_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_float; -} - -static void -_arg_cache_to_py_float_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_float; -} - -static void -_arg_cache_from_py_double_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_double; -} - -static void -_arg_cache_to_py_double_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_double; -} - -static void -_arg_cache_from_py_unichar_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_unichar; -} - -static void -_arg_cache_to_py_unichar_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_unichar; -} - -static void -_arg_cache_from_py_gtype_setup (PyGIArgCache *arg_cache) +_arg_cache_from_py_void_setup (PyGIArgCache *arg_cache) { - arg_cache->from_py_marshaller = _pygi_marshal_from_py_gtype; + arg_cache->from_py_marshaller = _pygi_marshal_from_py_void; } static void -_arg_cache_to_py_gtype_setup (PyGIArgCache *arg_cache) +_arg_cache_to_py_void_setup (PyGIArgCache *arg_cache) { - arg_cache->to_py_marshaller = _pygi_marshal_to_py_gtype; + arg_cache->to_py_marshaller = _pygi_marshal_to_py_void; } static void _arg_cache_from_py_utf8_setup (PyGIArgCache *arg_cache, GITransfer transfer) { - arg_cache->from_py_marshaller = _pygi_marshal_from_py_utf8; + arg_cache->from_py_marshaller = _pygi_marshal_from_py_basic_type_cache_adapter; arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_utf8; } @@ -439,23 +295,7 @@ static void _arg_cache_to_py_utf8_setup (PyGIArgCache *arg_cache, GITransfer transfer) { - arg_cache->to_py_marshaller = _pygi_marshal_to_py_utf8; - arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_utf8; -} - -static void -_arg_cache_from_py_filename_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_filename; - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_utf8; -} - -static void -_arg_cache_to_py_filename_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_filename; + arg_cache->to_py_marshaller = _pygi_marshal_to_py_basic_type_cache_adapter; arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_utf8; } @@ -606,14 +446,14 @@ static void _arg_cache_from_py_interface_union_setup (PyGIArgCache *arg_cache, GITransfer transfer) { - arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct; + arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct_cache_adapter; } static void _arg_cache_to_py_interface_union_setup (PyGIArgCache *arg_cache, GITransfer transfer) { - arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct; + arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct_cache_adapter; } static void @@ -623,7 +463,7 @@ _arg_cache_from_py_interface_struct_setup (PyGIArgCache *arg_cache, { PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info); - arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct; + arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct_cache_adapter; if (iface_cache->g_type == G_TYPE_VALUE) arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_struct_gvalue; @@ -638,7 +478,7 @@ _arg_cache_to_py_interface_struct_setup (PyGIArgCache *arg_cache, { PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info); - arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct; + arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct_cache_adapter; if (iface_cache->is_foreign) arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_interface_struct_foreign; @@ -656,7 +496,7 @@ static void _arg_cache_to_py_interface_object_setup (PyGIArgCache *arg_cache, GITransfer transfer) { - arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_object; + arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_object_cache_adapter; arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_interface_object; } @@ -870,161 +710,31 @@ _arg_cache_new (GITypeInfo *type_info, break; case GI_TYPE_TAG_BOOLEAN: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_boolean_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_boolean_setup (arg_cache); - - break; case GI_TYPE_TAG_INT8: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_int8_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_int8_setup (arg_cache); - - break; case GI_TYPE_TAG_UINT8: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_uint8_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_uint8_setup (arg_cache); - - break; case GI_TYPE_TAG_INT16: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_int16_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_int16_setup (arg_cache); - - break; case GI_TYPE_TAG_UINT16: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_uint16_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_uint16_setup (arg_cache); - break; case GI_TYPE_TAG_INT32: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_int32_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_int32_setup (arg_cache); - - break; case GI_TYPE_TAG_UINT32: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_uint32_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_uint32_setup (arg_cache); - - break; case GI_TYPE_TAG_INT64: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_int64_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_int64_setup (arg_cache); - - break; case GI_TYPE_TAG_UINT64: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_uint64_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_uint64_setup (arg_cache); - - break; case GI_TYPE_TAG_FLOAT: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_float_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_float_setup (arg_cache); - - break; case GI_TYPE_TAG_DOUBLE: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_double_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_double_setup (arg_cache); - - break; case GI_TYPE_TAG_UNICHAR: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_unichar_setup (arg_cache); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_unichar_setup (arg_cache); - - break; case GI_TYPE_TAG_GTYPE: arg_cache = _arg_cache_alloc (); if (arg_cache == NULL) break; if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_gtype_setup (arg_cache); + _arg_cache_from_py_basic_type_setup (arg_cache); if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_gtype_setup (arg_cache); + _arg_cache_to_py_basic_type_setup (arg_cache); break; case GI_TYPE_TAG_UTF8: + case GI_TYPE_TAG_FILENAME: arg_cache = _arg_cache_alloc (); if (arg_cache == NULL) break; @@ -1036,18 +746,6 @@ _arg_cache_new (GITypeInfo *type_info, _arg_cache_to_py_utf8_setup (arg_cache, transfer); break; - case GI_TYPE_TAG_FILENAME: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; - - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_filename_setup (arg_cache, transfer); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_filename_setup (arg_cache, transfer); - - break; case GI_TYPE_TAG_ARRAY: { PyGISequenceCache *seq_cache = @@ -1387,6 +1085,7 @@ _args_cache_generate (GICallableInfo *callable_info, arg_cache->type_tag = g_type_info_get_tag (type_info); + g_base_info_unref (type_info); g_base_info_unref ( (GIBaseInfo *)arg_info); continue; } diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c index f30fa52..7582069 100644 --- a/gi/pygi-closure.c +++ b/gi/pygi-closure.c @@ -33,6 +33,9 @@ _pygi_closure_assign_pyobj_to_retval (gpointer retval, PyObject *object, GITransfer transfer) { GIArgument arg = _pygi_argument_from_object (object, type_info, transfer); + if (PyErr_Occurred ()) + return; + GITypeTag type_tag = g_type_info_get_tag (type_info); if (retval == NULL) @@ -108,6 +111,19 @@ _pygi_closure_assign_pyobj_to_retval (gpointer retval, PyObject *object, } static void +_pygi_closure_clear_retval (GICallableInfo *callable_info, gpointer retval) +{ + GITypeInfo return_type_info; + GITypeTag return_type_tag; + + g_callable_info_load_return_type (callable_info, &return_type_info); + return_type_tag = g_type_info_get_tag (&return_type_info); + if (return_type_tag != GI_TYPE_TAG_VOID) { + *((ffi_arg *) retval) = 0; + } +} + +static void _pygi_closure_assign_pyobj_to_out_argument (gpointer out_arg, PyObject *object, GITypeInfo *type_info, GITransfer transfer) @@ -505,15 +521,8 @@ _pygi_invoke_closure_clear_py_data(PyGICClosure *invoke_closure) { PyGILState_STATE state = PyGILState_Ensure(); - if (invoke_closure->function != NULL) { - Py_DECREF (invoke_closure->function); - invoke_closure->function = NULL; - } - - if (invoke_closure->user_data != NULL) { - Py_DECREF (invoke_closure->user_data); - invoke_closure->user_data = NULL; - } + Py_CLEAR (invoke_closure->function); + Py_CLEAR (invoke_closure->user_data); PyGILState_Release (state); } @@ -546,11 +555,17 @@ _pygi_closure_handle (ffi_cif *cif, Py_DECREF (py_args); if (retval == NULL) { + _pygi_closure_clear_retval (closure->info, result); PyErr_Print(); goto end; } _pygi_closure_set_out_arguments (closure->info, retval, out_args, result); + if (PyErr_Occurred ()) { + _pygi_closure_clear_retval (closure->info, result); + PyErr_Print(); + } + Py_DECREF (retval); end: diff --git a/gi/pygi-info.c b/gi/pygi-info.c index 3e8fcb8..7164ff9 100644 --- a/gi/pygi-info.c +++ b/gi/pygi-info.c @@ -27,6 +27,33 @@ #include <pygobject.h> #include <pyglib-python-compat.h> + +/* _generate_doc_string + * + * C wrapper to call Python implemented "gi.docstring.generate_doc_string" + */ +static PyObject * +_generate_doc_string(PyGIBaseInfo *self) +{ + static PyObject *_py_generate_doc_string = NULL; + + if (_py_generate_doc_string == NULL) { + PyObject *mod = PyImport_ImportModule ("gi.docstring"); + if (!mod) + return NULL; + + _py_generate_doc_string = PyObject_GetAttrString (mod, "generate_doc_string"); + if (_py_generate_doc_string == NULL) { + Py_DECREF (mod); + return NULL; + } + Py_DECREF (mod); + } + + return PyObject_CallFunctionObjArgs (_py_generate_doc_string, self, NULL); +} + + /* BaseInfo */ static void @@ -170,6 +197,55 @@ static PyMethodDef _PyGIBaseInfo_methods[] = { { NULL, NULL, 0 } }; +/* _base_info_getattro: + * + * The usage of __getattr__ is needed because the get/set method table + * does not work for __doc__. + */ +static PyObject * +_base_info_getattro(PyGIBaseInfo *self, PyObject *name) +{ + PyObject *result; + + static PyObject *docstr; + if (docstr == NULL) { + docstr= PYGLIB_PyUnicode_InternFromString("__doc__"); + if (docstr == NULL) + return NULL; + } + + Py_INCREF (name); + PYGLIB_PyUnicode_InternInPlace (&name); + + if (name == docstr) { + result = _generate_doc_string (self); + } else { + result = PyObject_GenericGetAttr ((PyObject *)self, name); + } + + Py_DECREF (name); + return result; +} + +static PyObject * +_base_info_attr_name(PyGIBaseInfo *self, void *closure) +{ + return _wrap_g_base_info_get_name (self); +} + +static PyObject * +_base_info_attr_module(PyGIBaseInfo *self, void *closure) +{ + return PYGLIB_PyUnicode_FromFormat ("gi.repository.%s", + g_base_info_get_namespace (self->info)); +} + +static PyGetSetDef _base_info_getsets[] = { + { "__name__", (getter)_base_info_attr_name, (setter)0, "Name", NULL}, + { "__module__", (getter)_base_info_attr_module, (setter)0, "Module name", NULL}, + { NULL, 0, 0 } +}; + PyObject * _pygi_info_new (GIBaseInfo *info) { @@ -281,7 +357,7 @@ out: /* CallableInfo */ -PYGLIB_DEFINE_TYPE ("gi.CallableInfo", PyGICallableInfo_Type, PyGIBaseInfo); +PYGLIB_DEFINE_TYPE ("gi.CallableInfo", PyGICallableInfo_Type, PyGICallableInfo); static PyObject * _wrap_g_callable_info_get_arguments (PyGIBaseInfo *self) @@ -319,6 +395,183 @@ _wrap_g_callable_info_get_arguments (PyGIBaseInfo *self) return infos; } + +/* _callable_info_call: + * + * Shared wrapper for invoke which can be bound (instance method or class constructor) + * or unbound (function or static method). + */ +static PyObject * +_callable_info_call (PyGICallableInfo *self, PyObject *args, PyObject *kwargs) +{ + /* Insert the bound arg at the beginning of the invoke method args. */ + if (self->py_bound_arg) { + int i; + PyObject *result; + Py_ssize_t argcount = PyTuple_Size (args); + PyObject *newargs = PyTuple_New (argcount + 1); + if (newargs == NULL) + return NULL; + + Py_INCREF (self->py_bound_arg); + PyTuple_SET_ITEM (newargs, 0, self->py_bound_arg); + + for (i = 0; i < argcount; i++) { + PyObject *v = PyTuple_GET_ITEM (args, i); + Py_XINCREF (v); + PyTuple_SET_ITEM (newargs, i+1, v); + } + + /* Invoke with the original GI info struct this wrapper was based upon. + * This is necessary to maintain the same cache for all bound versions. + */ + result = _wrap_g_callable_info_invoke ((PyGIBaseInfo *)self->py_unbound_info, + newargs, kwargs); + Py_DECREF (newargs); + return result; + + } else { + /* We should never have an unbound info when calling when calling invoke + * at this point because the descriptor implementation on sub-classes + * should return "self" not a copy when there is no bound arg. + */ + g_assert (self->py_unbound_info == NULL); + return _wrap_g_callable_info_invoke ((PyGIBaseInfo *)self, args, kwargs); + } +} + + +/* _function_info_call: + * + * Specialization of _callable_info_call for GIFunctionInfo which + * handles constructor error conditions. + */ +static PyObject * +_function_info_call (PyGICallableInfo *self, PyObject *args, PyObject *kwargs) +{ + if (self->py_bound_arg) { + GIFunctionInfoFlags flags; + + /* Ensure constructors are only called as class methods on the class + * implementing the constructor and not on sub-classes. + */ + flags = g_function_info_get_flags ( (GIFunctionInfo*) self->base.info); + if (flags & GI_FUNCTION_IS_CONSTRUCTOR) { + PyObject *py_str_name; + const gchar *str_name; + GIBaseInfo *container_info = g_base_info_get_container (self->base.info); + g_assert (container_info != NULL); + + py_str_name = PyObject_GetAttrString (self->py_bound_arg, "__name__"); + if (py_str_name == NULL) + return NULL; + + if (PyUnicode_Check (py_str_name) ) { + PyObject *tmp = PyUnicode_AsUTF8String (py_str_name); + Py_DECREF (py_str_name); + py_str_name = tmp; + } + +#if PY_VERSION_HEX < 0x03000000 + str_name = PyString_AsString (py_str_name); +#else + str_name = PyBytes_AsString (py_str_name); +#endif + + if (strcmp (str_name, g_base_info_get_name (container_info))) { + PyErr_Format (PyExc_TypeError, + "%s constructor cannot be used to create instances of " + "a subclass %s", + g_base_info_get_name (container_info), + str_name); + Py_DECREF (py_str_name); + return NULL; + } + Py_DECREF (py_str_name); + } + } + + return _callable_info_call (self, args, kwargs); +} + +/* _new_bound_callable_info + * + * Utility function for sub-classes to create a bound version of themself. + */ +static PyGICallableInfo * +_new_bound_callable_info (PyGICallableInfo *self, PyObject *bound_arg) +{ + PyGICallableInfo *new_self; + + /* Return self if this is already bound or there is nothing passed to bind. */ + if (self->py_bound_arg != NULL || bound_arg == NULL || bound_arg == Py_None) { + Py_INCREF ((PyObject *)self); + return self; + } + + new_self = (PyGICallableInfo *)_pygi_info_new (self->base.info); + if (new_self == NULL) + return NULL; + + Py_INCREF ((PyObject *)self); + new_self->py_unbound_info = (struct PyGICallableInfo *)self; + + Py_INCREF (bound_arg); + new_self->py_bound_arg = bound_arg; + + return new_self; +} + +/* _function_info_descr_get + * + * Descriptor protocol implementation for functions, methods, and constructors. + */ +static PyObject * +_function_info_descr_get (PyGICallableInfo *self, PyObject *obj, PyObject *type) { + GIFunctionInfoFlags flags; + PyObject *bound_arg = NULL; + + flags = g_function_info_get_flags ( (GIFunctionInfo*) self->base.info); + if (flags & GI_FUNCTION_IS_CONSTRUCTOR) { + if (type == NULL) + bound_arg = (PyObject *)(Py_TYPE(obj)); + else + bound_arg = type; + } else if (flags & GI_FUNCTION_IS_METHOD) { + bound_arg = obj; + } + + return (PyObject *)_new_bound_callable_info (self, bound_arg); +} + +/* _vfunc_info_descr_get + * + * Descriptor protocol implementation for virtual functions. + */ +static PyObject * +_vfunc_info_descr_get (PyGICallableInfo *self, PyObject *obj, PyObject *type) { + PyObject *result; + PyObject *bound_arg = NULL; + + bound_arg = PyObject_GetAttrString (type, "__gtype__"); + if (bound_arg == NULL) + return NULL; + + /* _new_bound_callable_info adds its own ref so free the one from GetAttrString */ + result = (PyObject *)_new_bound_callable_info (self, bound_arg); + Py_DECREF (bound_arg); + return result; +} + +static void +_callable_info_dealloc (PyGICallableInfo *self) +{ + Py_CLEAR (self->py_unbound_info); + Py_CLEAR (self->py_bound_arg); + + PyGIBaseInfo_Type.tp_dealloc ((PyObject *) self); +} + static PyMethodDef _PyGICallableInfo_methods[] = { { "invoke", (PyCFunction) _wrap_g_callable_info_invoke, METH_VARARGS | METH_KEYWORDS }, { "get_arguments", (PyCFunction) _wrap_g_callable_info_get_arguments, METH_NOARGS }, @@ -427,6 +680,7 @@ _g_arg_get_pytype_hint (PyGIBaseInfo *self) const char *info_name; PyObject *py_string; GIBaseInfo *iface = g_type_info_get_interface(&type_info); + gchar *name; info_name = g_base_info_get_name (iface); if (info_name == NULL) { @@ -434,7 +688,7 @@ _g_arg_get_pytype_hint (PyGIBaseInfo *self) return PYGLIB_PyUnicode_FromString(g_type_tag_to_string(type_tag)); } - gchar *name = g_strdup_printf("%s.%s", + name = g_strdup_printf("%s.%s", g_base_info_get_namespace(iface), info_name); g_base_info_unref(iface); @@ -466,7 +720,7 @@ static PyMethodDef _PyGITypeInfo_methods[] = { /* FunctionInfo */ -PYGLIB_DEFINE_TYPE ("gi.FunctionInfo", PyGIFunctionInfo_Type, PyGIBaseInfo); +PYGLIB_DEFINE_TYPE ("gi.FunctionInfo", PyGIFunctionInfo_Type, PyGICallableInfo); static PyObject * _wrap_g_function_info_is_constructor (PyGIBaseInfo *self) @@ -652,7 +906,6 @@ static PyMethodDef _PyGIFunctionInfo_methods[] = { { NULL, NULL, 0 } }; - /* RegisteredTypeInfo */ PYGLIB_DEFINE_TYPE ("gi.RegisteredTypeInfo", PyGIRegisteredTypeInfo_Type, PyGIBaseInfo); @@ -1590,7 +1843,7 @@ static PyMethodDef _PyGIUnresolvedInfo_methods[] = { }; /* GIVFuncInfo */ -PYGLIB_DEFINE_TYPE ("gi.VFuncInfo", PyGIVFuncInfo_Type, PyGIBaseInfo); +PYGLIB_DEFINE_TYPE ("gi.VFuncInfo", PyGIVFuncInfo_Type, PyGICallableInfo); static PyObject * _wrap_g_vfunc_info_get_invoker (PyGIBaseInfo *self) @@ -1741,12 +1994,13 @@ _pygi_info_register_types (PyObject *m) PyGIBaseInfo_Type.tp_repr = (reprfunc) _base_info_repr; PyGIBaseInfo_Type.tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE); PyGIBaseInfo_Type.tp_weaklistoffset = offsetof(PyGIBaseInfo, inst_weakreflist); - PyGIBaseInfo_Type.tp_methods = _PyGIBaseInfo_methods; + PyGIBaseInfo_Type.tp_methods = _PyGIBaseInfo_methods; PyGIBaseInfo_Type.tp_richcompare = (richcmpfunc)_base_info_richcompare; + PyGIBaseInfo_Type.tp_getset = _base_info_getsets; + PyGIBaseInfo_Type.tp_getattro = (getattrofunc) _base_info_getattro; if (PyType_Ready(&PyGIBaseInfo_Type)) - return; - + return; if (PyModule_AddObject(m, "BaseInfo", (PyObject *)&PyGIBaseInfo_Type)) return; @@ -1757,14 +2011,24 @@ _pygi_info_register_types (PyObject *m) if (PyModule_AddObject(m, "DIRECTION_INOUT", PyLong_FromLong(GI_DIRECTION_INOUT))) return; - _PyGI_REGISTER_TYPE (m, PyGIUnresolvedInfo_Type, UnresolvedInfo, - PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGICallableInfo_Type, CallableInfo, PyGIBaseInfo_Type); - _PyGI_REGISTER_TYPE (m, PyGICallbackInfo_Type, CallbackInfo, - PyGIBaseInfo_Type); + PyGICallableInfo_Type.tp_call = (ternaryfunc) _callable_info_call; + PyGICallableInfo_Type.tp_dealloc = (destructor) _callable_info_dealloc; + _PyGI_REGISTER_TYPE (m, PyGIFunctionInfo_Type, FunctionInfo, PyGICallableInfo_Type); + PyGIFunctionInfo_Type.tp_call = (ternaryfunc) _function_info_call; + PyGIFunctionInfo_Type.tp_descr_get = (descrgetfunc) _function_info_descr_get; + + _PyGI_REGISTER_TYPE (m, PyGIVFuncInfo_Type, VFuncInfo, + PyGICallableInfo_Type); + PyGIVFuncInfo_Type.tp_descr_get = (descrgetfunc) _vfunc_info_descr_get; + + _PyGI_REGISTER_TYPE (m, PyGIUnresolvedInfo_Type, UnresolvedInfo, + PyGIBaseInfo_Type); + _PyGI_REGISTER_TYPE (m, PyGICallbackInfo_Type, CallbackInfo, + PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIRegisteredTypeInfo_Type, RegisteredTypeInfo, PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIStructInfo_Type, StructInfo, @@ -1781,8 +2045,6 @@ _pygi_info_register_types (PyObject *m) PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIFieldInfo_Type, FieldInfo, PyGIBaseInfo_Type); - _PyGI_REGISTER_TYPE (m, PyGIVFuncInfo_Type, VFuncInfo, - PyGICallableInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIUnionInfo_Type, UnionInfo, PyGIRegisteredTypeInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIBoxedInfo_Type, BoxedInfo, diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c index ec5da91..17cd278 100644 --- a/gi/pygi-invoke.c +++ b/gi/pygi-invoke.c @@ -136,22 +136,14 @@ _check_for_unexpected_kwargs (const gchar *function_name, /** * _py_args_combine_and_check_length: - * @function_name: the name of the function being called. Used for error messages. - * @arg_name_list: a list of the string names for each argument. The length - * of this list is the number of required arguments for the - * function. If an argument has no name, NULL is put in its - * position in the list. - * @py_args: the tuple of positional arguments. A referece is stolen, and this - tuple will be either decreffed or returned as is. + * @cache: PyGICallableCache + * @py_args: the tuple of positional arguments. * @py_kwargs: the dict of keyword arguments to be merged with py_args. - * A reference is borrowed. * - * Returns: The py_args and py_kwargs combined into one tuple. + * Returns: New value reference to the combined py_args and py_kwargs. */ static PyObject * -_py_args_combine_and_check_length (const gchar *function_name, - GSList *arg_name_list, - GHashTable *arg_name_hash, +_py_args_combine_and_check_length (PyGICallableCache *cache, PyObject *py_args, PyObject *py_kwargs) { @@ -159,6 +151,7 @@ _py_args_combine_and_check_length (const gchar *function_name, Py_ssize_t n_py_args, n_py_kwargs, i; guint n_expected_args; GSList *l; + const gchar *function_name = cache->name; n_py_args = PyTuple_GET_SIZE (py_args); if (py_kwargs == NULL) @@ -166,8 +159,10 @@ _py_args_combine_and_check_length (const gchar *function_name, else n_py_kwargs = PyDict_Size (py_kwargs); - n_expected_args = g_slist_length (arg_name_list); + /* Fast path, we already have the exact number of args and not kwargs. */ + n_expected_args = g_slist_length (cache->arg_name_list); if (n_py_kwargs == 0 && n_py_args == n_expected_args) { + Py_INCREF (py_args); return py_args; } @@ -179,15 +174,12 @@ _py_args_combine_and_check_length (const gchar *function_name, n_py_kwargs > 0 ? "non-keyword " : "", n_expected_args == 1 ? "" : "s", n_py_args); - - Py_DECREF (py_args); return NULL; } if (n_py_kwargs > 0 && !_check_for_unexpected_kwargs (function_name, - arg_name_hash, + cache->arg_name_hash, py_kwargs)) { - Py_DECREF (py_args); return NULL; } @@ -201,9 +193,7 @@ _py_args_combine_and_check_length (const gchar *function_name, PyTuple_SET_ITEM (combined_py_args, i, item); } - Py_CLEAR(py_args); - - for (i = 0, l = arg_name_list; i < n_expected_args && l; i++, l = l->next) { + for (i = 0, l = cache->arg_name_list; i < n_expected_args && l; i++, l = l->next) { PyObject *py_arg_item, *kw_arg_item = NULL; const gchar *arg_name = l->data; @@ -250,6 +240,7 @@ _invoke_state_init_from_callable_cache (PyGIInvokeState *state, PyObject *py_args, PyObject *kwargs) { + PyObject *combined_args = NULL; state->implementor_gtype = 0; /* TODO: We don't use the class parameter sent in by the structure @@ -292,17 +283,16 @@ _invoke_state_init_from_callable_cache (PyGIInvokeState *state, * code more error prone and confusing so don't do that unless profiling shows * significant gain */ - state->py_in_args = PyTuple_GetSlice (py_args, 1, PyTuple_Size (py_args)); + combined_args = PyTuple_GetSlice (py_args, 1, PyTuple_Size (py_args)); } else { - state->py_in_args = py_args; - Py_INCREF (state->py_in_args); + combined_args = py_args; + Py_INCREF (combined_args); } - state->py_in_args = _py_args_combine_and_check_length (cache->name, - cache->arg_name_list, - cache->arg_name_hash, - state->py_in_args, + state->py_in_args = _py_args_combine_and_check_length (cache, + combined_args, kwargs); + Py_DECREF (combined_args); if (state->py_in_args == NULL) { return FALSE; diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c index 639a226..a48479b 100644 --- a/gi/pygi-marshal-from-py.c +++ b/gi/pygi-marshal-from-py.c @@ -251,431 +251,27 @@ _pygi_marshal_from_py_void (PyGIInvokeState *state, { g_warn_if_fail (arg_cache->transfer == GI_TRANSFER_NOTHING); - if (PYGLIB_CPointer_Check(py_arg)) { + if (py_arg == Py_None) { + arg->v_pointer = NULL; + } else if (PYGLIB_CPointer_Check(py_arg)) { arg->v_pointer = PYGLIB_CPointer_GetPointer (py_arg, NULL); } else { - arg->v_pointer = py_arg; - } - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_boolean (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - arg->v_boolean = PyObject_IsTrue (py_arg); - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_int8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyObject *py_long; - long long_; - - if (PYGLIB_PyBytes_Check (py_arg)) { - - if (PYGLIB_PyBytes_Size (py_arg) != 1) { - PyErr_Format (PyExc_TypeError, "Must be a single character"); - return FALSE; - } - - long_ = (char)(PYGLIB_PyBytes_AsString (py_arg)[0]); - } else if (PyNumber_Check (py_arg)) { - py_long = PYGLIB_PyNumber_Long (py_arg); - if (!py_long) - return FALSE; - - long_ = PYGLIB_PyLong_AsLong (py_long); - Py_DECREF (py_long); - - if (PyErr_Occurred ()) { - PyErr_Clear (); - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, -128, 127); - return FALSE; - } - } else { - PyErr_Format (PyExc_TypeError, "Must be number or single byte string, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - if (long_ < -128 || long_ > 127) { - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, -128, 127); - return FALSE; - } - - arg->v_int8 = long_; - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_uint8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - unsigned long long_; - - if (PYGLIB_PyBytes_Check (py_arg)) { - - if (PYGLIB_PyBytes_Size (py_arg) != 1) { - PyErr_Format (PyExc_TypeError, "Must be a single character"); - return FALSE; - } - - long_ = (unsigned char)(PYGLIB_PyBytes_AsString (py_arg)[0]); - - } else if (PyNumber_Check (py_arg)) { - PyObject *py_long; - py_long = PYGLIB_PyNumber_Long (py_arg); - if (!py_long) - return FALSE; - - long_ = PYGLIB_PyLong_AsLong (py_long); - Py_DECREF (py_long); - - if (PyErr_Occurred ()) { - PyErr_Clear(); - - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, 0, 255); - return FALSE; - } - } else { - PyErr_Format (PyExc_TypeError, "Must be number or single byte string, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - if (long_ < 0 || long_ > 255) { - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, 0, 255); - return FALSE; - } - - arg->v_uint8 = long_; - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_int16 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyObject *py_long; - long long_; - - if (!PyNumber_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be number, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - py_long = PYGLIB_PyNumber_Long (py_arg); - if (!py_long) - return FALSE; - - long_ = PYGLIB_PyLong_AsLong (py_long); - Py_DECREF (py_long); - - if (PyErr_Occurred ()) { - PyErr_Clear (); - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, -32768, 32767); - return FALSE; - } - - if (long_ < -32768 || long_ > 32767) { - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, -32768, 32767); - return FALSE; - } - - arg->v_int16 = long_; - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_uint16 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyObject *py_long; - long long_; - - if (!PyNumber_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be number, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - py_long = PYGLIB_PyNumber_Long (py_arg); - if (!py_long) - return FALSE; - - long_ = PYGLIB_PyLong_AsLong (py_long); - Py_DECREF (py_long); - - if (PyErr_Occurred ()) { - PyErr_Clear (); - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, 0, 65535); - return FALSE; - } - - if (long_ < 0 || long_ > 65535) { - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, 0, 65535); - return FALSE; - } - - arg->v_uint16 = long_; - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_int32 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyObject *py_long; - long long_; - - if (!PyNumber_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be number, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - py_long = PYGLIB_PyNumber_Long (py_arg); - if (!py_long) - return FALSE; - - long_ = PYGLIB_PyLong_AsLong (py_long); - Py_DECREF (py_long); - - if (PyErr_Occurred ()) { - PyErr_Clear(); - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, G_MININT32, G_MAXINT32); - return FALSE; - } - - if (long_ < G_MININT32 || long_ > G_MAXINT32) { - PyErr_Format (PyExc_ValueError, "%ld not in range %d to %d", long_, G_MININT32, G_MAXINT32); - return FALSE; - } - - arg->v_int32 = long_; - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_uint32 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyObject *py_long; - long long long_; - - if (!PyNumber_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be number, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - py_long = PYGLIB_PyNumber_Long (py_arg); - if (!py_long) - return FALSE; - -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check (py_long)) - long_ = PyInt_AsLong (py_long); - else -#endif - long_ = PyLong_AsLongLong (py_long); - - Py_DECREF (py_long); - - if (PyErr_Occurred ()) { - PyErr_Clear (); - PyErr_Format (PyExc_ValueError, "%lld not in range %i to %u", long_, 0, G_MAXUINT32); - return FALSE; - } - - if (long_ < 0 || long_ > G_MAXUINT32) { - PyErr_Format (PyExc_ValueError, "%lld not in range %i to %u", long_, 0, G_MAXUINT32); - return FALSE; - } - - arg->v_uint32 = long_; - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_int64 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyObject *py_long; - gint64 long_; - - if (!PyNumber_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be number, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - py_long = PYGLIB_PyNumber_Long (py_arg); - if (!py_long) - return FALSE; - -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check (py_long)) - long_ = (gint64) PyInt_AS_LONG (py_long); - else -#endif - long_ = (gint64) PyLong_AsLongLong (py_long); - - Py_DECREF (py_long); - - if (PyErr_Occurred ()) { - /* OverflowError occured but range errors should be returned as ValueError */ - char *long_str; - PyObject *py_str; - - PyErr_Clear (); - - py_str = PyObject_Str (py_long); - - if (PyUnicode_Check (py_str)) { - PyObject *py_bytes = PyUnicode_AsUTF8String (py_str); - Py_DECREF (py_str); - - if (py_bytes == NULL) - return FALSE; - - long_str = g_strdup (PYGLIB_PyBytes_AsString (py_bytes)); - if (long_str == NULL) { - PyErr_NoMemory (); - return FALSE; - } - - Py_DECREF (py_bytes); - } else { - long_str = g_strdup (PYGLIB_PyBytes_AsString(py_str)); - Py_DECREF (py_str); - } - - PyErr_Format (PyExc_ValueError, "%s not in range %lld to %lld", - long_str, (long long) G_MININT64, (long long) G_MAXINT64); - - g_free (long_str); - return FALSE; - } - - arg->v_int64 = long_; - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_uint64 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyObject *py_long; - guint64 ulong_; - - if (!PyNumber_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be number, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - py_long = PYGLIB_PyNumber_Long (py_arg); - if (!py_long) - return FALSE; - -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check (py_long)) { - long long_ = PyInt_AsLong (py_long); - if (long_ < 0 || long_ > G_MAXUINT64) { - PyErr_Format (PyExc_ValueError, "%" G_GUINT64_FORMAT " not in range %d to %" G_GUINT64_FORMAT, - (gint64) long_, 0, G_MAXUINT64); - return FALSE; - } - ulong_ = (guint64) long_; - } else -#endif - ulong_ = PyLong_AsUnsignedLongLong (py_long); - - Py_DECREF (py_long); - - if (PyErr_Occurred ()) { - /* OverflowError occured but range errors should be returned as ValueError */ - char *long_str; - PyObject *py_str; - - PyErr_Clear (); - - py_str = PyObject_Str (py_long); - - if (PyUnicode_Check (py_str)) { - PyObject *py_bytes = PyUnicode_AsUTF8String (py_str); - Py_DECREF (py_str); - - if (py_bytes == NULL) - return FALSE; + /* NOTE: This will change to only allow integers and the deprecation + * warning will become a runtime exception. Using the following: + * arg->v_pointer = PyLong_AsVoidPtr (py_arg); + * See: https://bugzilla.gnome.org/show_bug.cgi?id=688081 + */ - long_str = g_strdup (PYGLIB_PyBytes_AsString (py_bytes)); - if (long_str == NULL) { - PyErr_NoMemory (); + if (!PYGLIB_PyLong_Check(py_arg) && !PyLong_Check(py_arg)) { + if (PyErr_WarnEx(PyGIDeprecationWarning, + "Pointer arguments will be restricted to integers, capsules, and None. " + "See: https://bugzilla.gnome.org/show_bug.cgi?id=683599", + 1)) return FALSE; - } - - Py_DECREF (py_bytes); - } else { - long_str = g_strdup (PYGLIB_PyBytes_AsString (py_str)); - Py_DECREF (py_str); } - - PyErr_Format (PyExc_ValueError, "%s not in range %d to %" G_GUINT64_FORMAT, - long_str, 0, G_MAXUINT64); - - g_free (long_str); - return FALSE; - } - - if (ulong_ > G_MAXUINT64) { - PyErr_Format (PyExc_ValueError, "%" G_GUINT64_FORMAT " not in range %d to %" G_GUINT64_FORMAT, ulong_, 0, G_MAXUINT64); - return FALSE; + arg->v_pointer = py_arg; } - arg->v_uint64 = ulong_; - return TRUE; } @@ -690,7 +286,7 @@ check_valid_double (double x, double min, double max) /* we need this as PyErr_Format() does not support float types */ snprintf (buf, sizeof (buf), "%g not in range %g to %g", x, min, max); - PyErr_SetString (PyExc_ValueError, buf); + PyErr_SetString (PyExc_OverflowError, buf); return FALSE; } return TRUE; @@ -718,11 +314,8 @@ _pygi_py_arg_to_double (PyObject *py_arg, double *double_) return TRUE; } -gboolean -_pygi_marshal_from_py_float (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, +static gboolean +_pygi_marshal_from_py_float (PyObject *py_arg, GIArgument *arg) { double double_; @@ -737,11 +330,8 @@ _pygi_marshal_from_py_float (PyGIInvokeState *state, return TRUE; } -gboolean -_pygi_marshal_from_py_double (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, +static gboolean +_pygi_marshal_from_py_double (PyObject *py_arg, GIArgument *arg) { double double_; @@ -756,11 +346,8 @@ _pygi_marshal_from_py_double (PyGIInvokeState *state, return TRUE; } -gboolean -_pygi_marshal_from_py_unichar (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, +static gboolean +_pygi_marshal_from_py_unichar (PyObject *py_arg, GIArgument *arg) { Py_ssize_t size; @@ -811,11 +398,8 @@ _pygi_marshal_from_py_unichar (PyGIInvokeState *state, return TRUE; } -gboolean -_pygi_marshal_from_py_gtype (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, +static gboolean +_pygi_marshal_from_py_gtype (PyObject *py_arg, GIArgument *arg) { long type_ = pyg_type_from_object (py_arg); @@ -829,11 +413,9 @@ _pygi_marshal_from_py_gtype (PyGIInvokeState *state, arg->v_long = type_; return TRUE; } -gboolean -_pygi_marshal_from_py_utf8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, + +static gboolean +_pygi_marshal_from_py_utf8 (PyObject *py_arg, GIArgument *arg) { gchar *string_; @@ -866,11 +448,8 @@ _pygi_marshal_from_py_utf8 (PyGIInvokeState *state, return TRUE; } -gboolean -_pygi_marshal_from_py_filename (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, +static gboolean +_pygi_marshal_from_py_filename (PyObject *py_arg, GIArgument *arg) { gchar *string_; @@ -908,6 +487,237 @@ _pygi_marshal_from_py_filename (PyGIInvokeState *state, return TRUE; } +static gboolean +_pygi_marshal_from_py_long (PyObject *object, /* in */ + GIArgument *arg, /* out */ + GITypeTag type_tag, + GITransfer transfer) +{ + PyObject *number; + + if (!PyNumber_Check (object)) { + PyErr_Format (PyExc_TypeError, "Must be number, not %s", + object->ob_type->tp_name); + return FALSE; + } + +#if PY_MAJOR_VERSION < 3 + { + PyObject *tmp = PyNumber_Int (object); + if (tmp) { + number = PyNumber_Long (tmp); + Py_DECREF (tmp); + } else { + number = PyNumber_Long (object); + } + } +#else + number = PyNumber_Long (object); +#endif + + if (number == NULL) { + PyErr_SetString (PyExc_TypeError, "expected int argument"); + return FALSE; + } + + switch (type_tag) { + case GI_TYPE_TAG_INT8: + { + long long_value = PyLong_AsLong (number); + if (PyErr_Occurred()) { + break; + } else if (long_value < G_MININT8 || long_value > G_MAXINT8) { + PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", + long_value, (long)G_MININT8, (long)G_MAXINT8); + } else { + arg->v_int8 = long_value; + } + break; + } + + case GI_TYPE_TAG_UINT8: + { + long long_value = PyLong_AsLong (number); + if (PyErr_Occurred()) { + break; + } else if (long_value < 0 || long_value > G_MAXUINT8) { + PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", + long_value, (long)0, (long)G_MAXUINT8); + } else { + arg->v_uint8 = long_value; + } + break; + } + + case GI_TYPE_TAG_INT16: + { + long long_value = PyLong_AsLong (number); + if (PyErr_Occurred()) { + break; + } else if (long_value < G_MININT16 || long_value > G_MAXINT16) { + PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", + long_value, (long)G_MININT16, (long)G_MAXINT16); + } else { + arg->v_int16 = long_value; + } + break; + } + + case GI_TYPE_TAG_UINT16: + { + long long_value = PyLong_AsLong (number); + if (PyErr_Occurred()) { + break; + } else if (long_value < 0 || long_value > G_MAXUINT16) { + PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", + long_value, (long)0, (long)G_MAXUINT16); + } else { + arg->v_uint16 = long_value; + } + break; + } + + case GI_TYPE_TAG_INT32: + { + long long_value = PyLong_AsLong (number); + if (PyErr_Occurred()) { + break; + } else if (long_value < G_MININT32 || long_value > G_MAXINT32) { + PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", + long_value, (long)G_MININT32, (long)G_MAXINT32); + } else { + arg->v_int32 = long_value; + } + break; + } + + case GI_TYPE_TAG_UINT32: + { + PY_LONG_LONG long_value = PyLong_AsLongLong (number); + if (PyErr_Occurred()) { + break; + } else if (long_value < 0 || long_value > G_MAXUINT32) { + PyErr_Format (PyExc_OverflowError, "%lld not in range %ld to %lu", + long_value, (long)0, (unsigned long)G_MAXUINT32); + } else { + arg->v_uint32 = long_value; + } + break; + } + + case GI_TYPE_TAG_INT64: + { + /* Rely on Python overflow error and convert to ValueError for 64 bit values */ + arg->v_int64 = PyLong_AsLongLong (number); + break; + } + + case GI_TYPE_TAG_UINT64: + { + /* Rely on Python overflow error and convert to ValueError for 64 bit values */ + arg->v_uint64 = PyLong_AsUnsignedLongLong (number); + break; + } + + default: + g_assert_not_reached (); + } + + Py_DECREF (number); + + if (PyErr_Occurred()) + return FALSE; + return TRUE; +} + +gboolean +_pygi_marshal_from_py_basic_type (PyObject *object, /* in */ + GIArgument *arg, /* out */ + GITypeTag type_tag, + GITransfer transfer) +{ + switch (type_tag) { + case GI_TYPE_TAG_VOID: + g_warn_if_fail (transfer == GI_TRANSFER_NOTHING); + if (object == Py_None) { + arg->v_pointer = NULL; + } else if (!PYGLIB_PyLong_Check(object) && !PyLong_Check(object)) { + PyErr_SetString(PyExc_TypeError, + "Pointer assignment is restricted to integer values. " + "See: https://bugzilla.gnome.org/show_bug.cgi?id=683599"); + } else { + arg->v_pointer = PyLong_AsVoidPtr (object); + } + break; + case GI_TYPE_TAG_INT8: + case GI_TYPE_TAG_UINT8: + if (PYGLIB_PyBytes_Check (object)) { + if (PYGLIB_PyBytes_Size (object) != 1) { + PyErr_Format (PyExc_TypeError, "Must be a single character"); + return FALSE; + } + if (type_tag == GI_TYPE_TAG_INT8) { + arg->v_int8 = (gint8)(PYGLIB_PyBytes_AsString (object)[0]); + } else { + arg->v_uint8 = (guint8)(PYGLIB_PyBytes_AsString (object)[0]); + } + } else { + return _pygi_marshal_from_py_long (object, arg, type_tag, transfer); + } + break; + case GI_TYPE_TAG_INT16: + case GI_TYPE_TAG_UINT16: + case GI_TYPE_TAG_INT32: + case GI_TYPE_TAG_UINT32: + case GI_TYPE_TAG_INT64: + case GI_TYPE_TAG_UINT64: + return _pygi_marshal_from_py_long (object, arg, type_tag, transfer); + + case GI_TYPE_TAG_BOOLEAN: + arg->v_boolean = PyObject_IsTrue (object); + break; + + case GI_TYPE_TAG_FLOAT: + return _pygi_marshal_from_py_float (object, arg); + + case GI_TYPE_TAG_DOUBLE: + return _pygi_marshal_from_py_double (object, arg); + + case GI_TYPE_TAG_GTYPE: + return _pygi_marshal_from_py_gtype (object, arg); + + case GI_TYPE_TAG_UNICHAR: + return _pygi_marshal_from_py_unichar (object, arg); + + case GI_TYPE_TAG_UTF8: + return _pygi_marshal_from_py_utf8 (object, arg); + + case GI_TYPE_TAG_FILENAME: + return _pygi_marshal_from_py_filename (object, arg); + + default: + return FALSE; + } + + if (PyErr_Occurred()) + return FALSE; + + return TRUE; +} + +gboolean +_pygi_marshal_from_py_basic_type_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg) +{ + return _pygi_marshal_from_py_basic_type (py_arg, + arg, + arg_cache->type_tag, + arg_cache->transfer); +} + gboolean _pygi_marshal_from_py_array (PyGIInvokeState *state, PyGICallableCache *callable_cache, @@ -1536,7 +1346,7 @@ _pygi_marshal_from_py_interface_enum (PyGIInvokeState *state, long c_long; gint is_instance; PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - GIBaseInfo *interface; + GIBaseInfo *interface = NULL; is_instance = PyObject_IsInstance (py_arg, iface_cache->py_type); @@ -1556,6 +1366,7 @@ _pygi_marshal_from_py_interface_enum (PyGIInvokeState *state, c_long, g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { g_assert_not_reached(); + g_base_info_unref (interface); return FALSE; } @@ -1581,9 +1392,12 @@ _pygi_marshal_from_py_interface_enum (PyGIInvokeState *state, goto err; } + g_base_info_unref (interface); return TRUE; err: + if (interface) + g_base_info_unref (interface); PyErr_Format (PyExc_TypeError, "Expected a %s, but got %s", iface_cache->type_name, py_arg->ob_type->tp_name); return FALSE; @@ -1622,9 +1436,11 @@ _pygi_marshal_from_py_interface_flags (PyGIInvokeState *state, g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_FLAGS); if (!gi_argument_from_c_long(arg, c_long, g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { + g_base_info_unref (interface); return FALSE; } + g_base_info_unref (interface); return TRUE; err: @@ -1635,24 +1451,24 @@ err: } gboolean -_pygi_marshal_from_py_interface_struct (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) +_pygi_marshal_from_py_interface_struct_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg) { PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - return pygi_marshal_from_py_interface_struct (py_arg, - arg, - arg_cache->arg_name, - iface_cache->interface_info, - arg_cache->type_info, - iface_cache->g_type, - iface_cache->py_type, - arg_cache->transfer, - arg_cache->is_caller_allocates, - iface_cache->is_foreign); + return _pygi_marshal_from_py_interface_struct (py_arg, + arg, + arg_cache->arg_name, + iface_cache->interface_info, + arg_cache->type_info, + iface_cache->g_type, + iface_cache->py_type, + arg_cache->transfer, + TRUE, /*copy_reference*/ + iface_cache->is_foreign); } gboolean @@ -1693,7 +1509,7 @@ _pygi_marshal_from_py_interface_object (PyGIInvokeState *state, return FALSE; } - return pygi_marshal_from_py_gobject (py_arg, arg, arg_cache->transfer); + return _pygi_marshal_from_py_gobject (py_arg, arg, arg_cache->transfer); } gboolean @@ -1785,14 +1601,14 @@ gboolean _pygi_marshal_from_py_interface_instance (PyGIInvokeState *state, return TRUE; } -/* pygi_marshal_from_py_gobject: +/* _pygi_marshal_from_py_gobject: * py_arg: (in): * arg: (out): */ gboolean -pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ - GIArgument *arg, /*out*/ - GITransfer transfer) { +_pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ + GIArgument *arg, /*out*/ + GITransfer transfer) { GObject *gobj; if (py_arg == Py_None) { @@ -1810,12 +1626,38 @@ pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ gobj = pygobject_get (py_arg); if (transfer == GI_TRANSFER_EVERYTHING) { - /* An easy case of adding a new ref that the caller will take ownership of. - * Pythons existing ref to the GObject will be managed normally with the wrapper. + /* 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. */ g_object_ref (gobj); + } + + arg->v_pointer = gobj; + return TRUE; +} + +/* _pygi_marshal_from_py_gobject_out_arg: + * py_arg: (in): + * arg: (out): + * + * A specialization for marshaling Python GObjects used for out/return values + * from a Python implemented vfuncs, signals, or an assignment to a GObject property. + */ +gboolean +_pygi_marshal_from_py_gobject_out_arg (PyObject *py_arg, /*in*/ + GIArgument *arg, /*out*/ + GITransfer transfer) { + GObject *gobj; + if (!_pygi_marshal_from_py_gobject (py_arg, arg, transfer)) { + return FALSE; + } - } else if (py_arg->ob_refcnt == 1 && gobj->ref_count == 1) { + /* HACK: At this point the basic marshaling of the GObject was successful + * but we add some special case hacks for vfunc returns due to buggy APIs: + * https://bugzilla.gnome.org/show_bug.cgi?id=693393 + */ + gobj = arg->v_pointer; + if (py_arg->ob_refcnt == 1 && gobj->ref_count == 1) { /* If both object ref counts are only 1 at this point (the reference held * in a return tuple), we assume the GObject will be free'd before reaching * its target and become invalid. So instead of getting invalid object errors @@ -1824,12 +1666,10 @@ pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ g_object_ref (gobj); if (((PyGObject *)py_arg)->private_flags.flags & PYGOBJECT_GOBJECT_WAS_FLOATING) { - /* HACK: + /* * We want to re-float instances that were floating and the Python * wrapper assumed ownership. With the additional caveat that there * are not any strong references beyond the return tuple. - * This should be removed once the following ticket is fixed: - * https://bugzilla.gnome.org/show_bug.cgi?id=693393 */ g_object_force_floating (gobj); @@ -1848,21 +1688,21 @@ pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ } } - arg->v_pointer = gobj; return TRUE; } -/* pygi_marshal_from_py_gvalue: +/* _pygi_marshal_from_py_gvalue: * py_arg: (in): * arg: (out): * transfer: - * is_allocated: TRUE if arg->v_pointer is an already allocated GValue + * copy_reference: TRUE if arg should use the pointer reference held by py_arg + * when it is already holding a GValue vs. copying the value. */ gboolean -pygi_marshal_from_py_gvalue (PyObject *py_arg, - GIArgument *arg, - GITransfer transfer, - gboolean is_allocated) { +_pygi_marshal_from_py_gvalue (PyObject *py_arg, + GIArgument *arg, + GITransfer transfer, + gboolean copy_reference) { GValue *value; GType object_type; @@ -1872,24 +1712,21 @@ pygi_marshal_from_py_gvalue (PyObject *py_arg, return FALSE; } - if (is_allocated) - value = (GValue *)arg->v_pointer; - else - value = g_slice_new0 (GValue); - /* if already a gvalue, use that, else marshal into gvalue */ if (object_type == G_TYPE_VALUE) { GValue *source_value = pyg_boxed_get (py_arg, GValue); - if (G_VALUE_TYPE (value) == G_TYPE_INVALID) + if (copy_reference) { + value = source_value; + } else { + value = g_slice_new0 (GValue); g_value_init (value, G_VALUE_TYPE (source_value)); - g_value_copy (source_value, value); + g_value_copy (source_value, value); + } } else { - if (G_VALUE_TYPE (value) == G_TYPE_INVALID) - g_value_init (value, object_type); - + value = g_slice_new0 (GValue); + g_value_init (value, object_type); if (pyg_value_from_pyobject (value, py_arg) < 0) { - if (!is_allocated) - g_slice_free (GValue, value); + g_slice_free (GValue, value); PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GValue failed"); return FALSE; } @@ -1899,13 +1736,13 @@ pygi_marshal_from_py_gvalue (PyObject *py_arg, return TRUE; } -/* pygi_marshal_from_py_gclosure: +/* _pygi_marshal_from_py_gclosure: * py_arg: (in): * arg: (out): */ gboolean -pygi_marshal_from_py_gclosure(PyObject *py_arg, - GIArgument *arg) +_pygi_marshal_from_py_gclosure(PyObject *py_arg, + GIArgument *arg) { GClosure *closure; GType object_gtype = pyg_type_from_object_strict (py_arg, FALSE); @@ -1932,16 +1769,16 @@ pygi_marshal_from_py_gclosure(PyObject *py_arg, } gboolean -pygi_marshal_from_py_interface_struct (PyObject *py_arg, - GIArgument *arg, - const gchar *arg_name, - GIBaseInfo *interface_info, - GITypeInfo *type_info, - GType g_type, - PyObject *py_type, - GITransfer transfer, - gboolean is_allocated, - gboolean is_foreign) +_pygi_marshal_from_py_interface_struct (PyObject *py_arg, + GIArgument *arg, + const gchar *arg_name, + GIBaseInfo *interface_info, + GITypeInfo *type_info, + GType g_type, + PyObject *py_type, + GITransfer transfer, + gboolean copy_reference, + gboolean is_foreign) { if (py_arg == Py_None) { arg->v_pointer = NULL; @@ -1953,12 +1790,12 @@ pygi_marshal_from_py_interface_struct (PyObject *py_arg, */ if (g_type_is_a (g_type, G_TYPE_CLOSURE)) { - return pygi_marshal_from_py_gclosure (py_arg, arg); + return _pygi_marshal_from_py_gclosure (py_arg, arg); } else if (g_type_is_a (g_type, G_TYPE_VALUE)) { - return pygi_marshal_from_py_gvalue(py_arg, - arg, - transfer, - is_allocated); + return _pygi_marshal_from_py_gvalue(py_arg, + arg, + transfer, + copy_reference); } else if (is_foreign) { PyObject *success; success = pygi_struct_foreign_convert_to_g_argument (py_arg, diff --git a/gi/pygi-marshal-from-py.h b/gi/pygi-marshal-from-py.h index 307d716..9f56a6f 100644 --- a/gi/pygi-marshal-from-py.h +++ b/gi/pygi-marshal-from-py.h @@ -38,81 +38,6 @@ gboolean _pygi_marshal_from_py_void (PyGIInvokeState *state, PyGIArgCache *arg_cache, PyObject *py_arg, GIArgument *arg); -gboolean _pygi_marshal_from_py_boolean (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_int8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_uint8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_int16 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_uint16 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_int32 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_uint32 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_int64 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_uint64 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_float (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_double (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_unichar (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_gtype (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_utf8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_filename (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); gboolean _pygi_marshal_from_py_array (PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, @@ -153,11 +78,11 @@ gboolean _pygi_marshal_from_py_interface_flags (PyGIInvokeState *state, PyGIArgCache *arg_cache, PyObject *py_arg, GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_struct (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); +gboolean _pygi_marshal_from_py_interface_struct_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg); gboolean _pygi_marshal_from_py_interface_interface(PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, @@ -185,27 +110,39 @@ gboolean _pygi_marshal_from_py_interface_instance (PyGIInvokeState *state, GIArgument *arg); /* Simplified marshalers shared between vfunc/closure and direct function calls. */ +gboolean _pygi_marshal_from_py_basic_type (PyObject *object, /* in */ + GIArgument *arg, /* out */ + GITypeTag type_tag, + GITransfer transfer); +gboolean _pygi_marshal_from_py_basic_type_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg); -gboolean pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ - GIArgument *arg, /*out*/ - GITransfer transfer); +gboolean _pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ + GIArgument *arg, /*out*/ + GITransfer transfer); +gboolean _pygi_marshal_from_py_gobject_out_arg (PyObject *py_arg, /*in*/ + GIArgument *arg, /*out*/ + GITransfer transfer); -gboolean pygi_marshal_from_py_gvalue (PyObject *py_arg, /*in*/ - GIArgument *arg, /*out*/ - GITransfer transfer, - gboolean is_allocated); +gboolean _pygi_marshal_from_py_gvalue (PyObject *py_arg, /*in*/ + GIArgument *arg, /*out*/ + GITransfer transfer, + gboolean is_allocated); -gboolean pygi_marshal_from_py_gclosure(PyObject *py_arg, /*in*/ - GIArgument *arg); /*out*/ +gboolean _pygi_marshal_from_py_gclosure(PyObject *py_arg, /*in*/ + GIArgument *arg); /*out*/ -gboolean pygi_marshal_from_py_interface_struct (PyObject *py_arg, - GIArgument *arg, - const gchar *arg_name, - GIBaseInfo *interface_info, - GITypeInfo *type_info, - GType g_type, - PyObject *py_type, - GITransfer transfer, +gboolean _pygi_marshal_from_py_interface_struct (PyObject *py_arg, + GIArgument *arg, + const gchar *arg_name, + GIBaseInfo *interface_info, + GITypeInfo *type_info, + GType g_type, + PyObject *py_type, + GITransfer transfer, gboolean is_allocated, gboolean is_foreign); diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c index 6e16b99..7c260f7 100644 --- a/gi/pygi-marshal-to-py.c +++ b/gi/pygi-marshal-to-py.c @@ -33,6 +33,7 @@ #include "pygi-cache.h" #include "pygi-marshal-cleanup.h" #include "pygi-marshal-to-py.h" +#include "pygi-argument.h" static gboolean gi_argument_to_c_long (GIArgument *arg_in, @@ -110,7 +111,6 @@ gi_argument_to_gsize (GIArgument *arg_in, } } - PyObject * _pygi_marshal_to_py_void (PyGIInvokeState *state, PyGICallableCache *callable_cache, @@ -118,139 +118,23 @@ _pygi_marshal_to_py_void (PyGIInvokeState *state, GIArgument *arg) { PyObject *py_obj = NULL; - if (arg_cache->is_pointer) + if (arg_cache->is_pointer) { + /* NOTE: This will change to interpret pointers as integer values + * by using the following: + * py_obj = PyLong_FromVoidPtr (arg->v_pointer); + * See: https://bugzilla.gnome.org/show_bug.cgi?id=688081 + */ py_obj = arg->v_pointer; - else + } else { py_obj = Py_None; + } Py_XINCREF (py_obj); return py_obj; } -PyObject * -_pygi_marshal_to_py_boolean (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PyBool_FromLong (arg->v_boolean); - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_int8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PYGLIB_PyLong_FromLong (arg->v_int8); - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_uint8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PYGLIB_PyLong_FromLong (arg->v_uint8); - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_int16 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PYGLIB_PyLong_FromLong (arg->v_int16); - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_uint16 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PYGLIB_PyLong_FromLong (arg->v_uint16); - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_int32 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PYGLIB_PyLong_FromLong (arg->v_int32); - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_uint32 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PyLong_FromLongLong (arg->v_uint32); - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_int64 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PyLong_FromLongLong (arg->v_int64); - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_uint64 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PyLong_FromUnsignedLongLong (arg->v_uint64); - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_float (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PyFloat_FromDouble (arg->v_float); - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_double (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = PyFloat_FromDouble (arg->v_double); - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_unichar (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) +static PyObject * +_pygi_marshal_to_py_unichar (GIArgument *arg) { PyObject *py_obj = NULL; @@ -273,23 +157,8 @@ _pygi_marshal_to_py_unichar (PyGIInvokeState *state, return py_obj; } -PyObject * -_pygi_marshal_to_py_gtype (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = NULL; - - py_obj = pyg_type_wrapper_new ( (GType)arg->v_long); - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_utf8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) +static PyObject * +_pygi_marshal_to_py_utf8 (GIArgument *arg) { PyObject *py_obj = NULL; if (arg->v_string == NULL) { @@ -300,11 +169,8 @@ _pygi_marshal_to_py_utf8 (PyGIInvokeState *state, return py_obj; } -PyObject * -_pygi_marshal_to_py_filename (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) +static PyObject * +_pygi_marshal_to_py_filename (GIArgument *arg) { gchar *string = NULL; PyObject *py_obj = NULL; @@ -327,6 +193,89 @@ _pygi_marshal_to_py_filename (PyGIInvokeState *state, return py_obj; } + +/** + * _pygi_marshal_to_py_basic_type: + * @arg: The argument to convert to an object. + * @type_tag: Type tag for @arg + * @transfer: Transfer annotation + * + * Convert the given argument to a Python object. This function + * is restricted to simple types that only require the GITypeTag + * and GITransfer. For a more complete conversion routine, use: + * _pygi_argument_to_object. + * + * Returns: A PyObject representing @arg or NULL if it cannot convert + * the argument. + */ +PyObject * +_pygi_marshal_to_py_basic_type (GIArgument *arg, + GITypeTag type_tag, + GITransfer transfer) +{ + switch (type_tag) { + case GI_TYPE_TAG_BOOLEAN: + return PyBool_FromLong (arg->v_boolean); + + case GI_TYPE_TAG_INT8: + return PYGLIB_PyLong_FromLong (arg->v_int8); + + case GI_TYPE_TAG_UINT8: + return PYGLIB_PyLong_FromLong (arg->v_uint8); + + case GI_TYPE_TAG_INT16: + return PYGLIB_PyLong_FromLong (arg->v_int16); + + case GI_TYPE_TAG_UINT16: + return PYGLIB_PyLong_FromLong (arg->v_uint16); + + case GI_TYPE_TAG_INT32: + return PYGLIB_PyLong_FromLong (arg->v_int32); + + case GI_TYPE_TAG_UINT32: + return PyLong_FromLongLong (arg->v_uint32); + + case GI_TYPE_TAG_INT64: + return PyLong_FromLongLong (arg->v_int64); + + case GI_TYPE_TAG_UINT64: + return PyLong_FromUnsignedLongLong (arg->v_uint64); + + case GI_TYPE_TAG_FLOAT: + return PyFloat_FromDouble (arg->v_float); + + case GI_TYPE_TAG_DOUBLE: + return PyFloat_FromDouble (arg->v_double); + + case GI_TYPE_TAG_GTYPE: + return pyg_type_wrapper_new ( (GType) arg->v_long); + + case GI_TYPE_TAG_UNICHAR: + return _pygi_marshal_to_py_unichar (arg); + + case GI_TYPE_TAG_UTF8: + return _pygi_marshal_to_py_utf8 (arg); + + case GI_TYPE_TAG_FILENAME: + return _pygi_marshal_to_py_filename (arg); + + default: + return NULL; + } + return NULL; +} + +PyObject * +_pygi_marshal_to_py_basic_type_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg) +{ + return _pygi_marshal_to_py_basic_type (arg, + arg_cache->type_tag, + arg_cache->transfer); +} + PyObject * _pygi_marshal_to_py_array (PyGIInvokeState *state, PyGICallableCache *callable_cache, @@ -740,6 +689,7 @@ _pygi_marshal_to_py_interface_enum (PyGIInvokeState *state, } else { py_obj = pyg_enum_from_gtype (iface_cache->g_type, c_long); } + g_base_info_unref (interface); return py_obj; } @@ -759,9 +709,11 @@ _pygi_marshal_to_py_interface_flags (PyGIInvokeState *state, if (!gi_argument_to_c_long(arg, &c_long, g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { + g_base_info_unref (interface); return NULL; } + g_base_info_unref (interface); if (iface_cache->g_type == G_TYPE_NONE) { /* An enum with a GType of None is an enum without GType */ @@ -790,20 +742,20 @@ _pygi_marshal_to_py_interface_flags (PyGIInvokeState *state, } PyObject * -_pygi_marshal_to_py_interface_struct (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) +_pygi_marshal_to_py_interface_struct_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg) { PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - return pygi_marshal_to_py_interface_struct (arg, - iface_cache->interface_info, - iface_cache->g_type, - iface_cache->py_type, - arg_cache->transfer, - arg_cache->is_caller_allocates, - iface_cache->is_foreign); + return _pygi_marshal_to_py_interface_struct (arg, + iface_cache->interface_info, + iface_cache->g_type, + iface_cache->py_type, + arg_cache->transfer, + arg_cache->is_caller_allocates, + iface_cache->is_foreign); } PyObject * @@ -833,12 +785,12 @@ _pygi_marshal_to_py_interface_boxed (PyGIInvokeState *state, } PyObject * -_pygi_marshal_to_py_interface_object (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) +_pygi_marshal_to_py_interface_object_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg) { - return pygi_marshal_to_py_object(arg, arg_cache->transfer); + return _pygi_marshal_to_py_object(arg, arg_cache->transfer); } PyObject * @@ -855,7 +807,7 @@ _pygi_marshal_to_py_interface_union (PyGIInvokeState *state, } PyObject * -pygi_marshal_to_py_object (GIArgument *arg, GITransfer transfer) { +_pygi_marshal_to_py_object (GIArgument *arg, GITransfer transfer) { PyObject *pyobj; if (arg->v_pointer == NULL) { @@ -877,13 +829,13 @@ pygi_marshal_to_py_object (GIArgument *arg, GITransfer transfer) { } PyObject * -pygi_marshal_to_py_interface_struct (GIArgument *arg, - GIInterfaceInfo *interface_info, - GType g_type, - PyObject *py_type, - GITransfer transfer, - gboolean is_allocated, - gboolean is_foreign) +_pygi_marshal_to_py_interface_struct (GIArgument *arg, + GIInterfaceInfo *interface_info, + GType g_type, + PyObject *py_type, + GITransfer transfer, + gboolean is_allocated, + gboolean is_foreign) { PyObject *py_obj = NULL; diff --git a/gi/pygi-marshal-to-py.h b/gi/pygi-marshal-to-py.h index 359644d..1378630 100644 --- a/gi/pygi-marshal-to-py.h +++ b/gi/pygi-marshal-to-py.h @@ -22,70 +22,17 @@ #ifndef __PYGI_MARSHAL_TO_PY_H__ #define __PYGI_MARSHAL_TO_PY_H__ +PyObject *_pygi_marshal_to_py_basic_type (GIArgument *arg, + GITypeTag type_tag, + GITransfer transfer); +PyObject *_pygi_marshal_to_py_basic_type_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg); PyObject *_pygi_marshal_to_py_void (PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, GIArgument *arg); -PyObject *_pygi_marshal_to_py_boolean (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_int8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_uint8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_int16 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_uint16 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_int32 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_uint32 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_int64 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_uint64 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_float (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_double (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_unichar (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_gtype (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_utf8 (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_filename (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); PyObject *_pygi_marshal_to_py_array (PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, @@ -118,10 +65,10 @@ PyObject *_pygi_marshal_to_py_interface_flags (PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_struct (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); +PyObject *_pygi_marshal_to_py_interface_struct_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg); PyObject *_pygi_marshal_to_py_interface_interface(PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, @@ -130,10 +77,10 @@ PyObject *_pygi_marshal_to_py_interface_boxed (PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_object (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); +PyObject *_pygi_marshal_to_py_interface_object_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg); PyObject *_pygi_marshal_to_py_interface_union (PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, @@ -141,16 +88,16 @@ PyObject *_pygi_marshal_to_py_interface_union (PyGIInvokeState *state, /* Simplified marshalers shared between vfunc/closure and direct function calls. */ -PyObject *pygi_marshal_to_py_object (GIArgument *arg, - GITransfer transfer); +PyObject *_pygi_marshal_to_py_object (GIArgument *arg, + GITransfer transfer); -PyObject *pygi_marshal_to_py_interface_struct (GIArgument *arg, - GIInterfaceInfo *interface_info, - GType g_type, - PyObject *py_type, - GITransfer transfer, - gboolean is_allocated, - gboolean is_foreign); +PyObject *_pygi_marshal_to_py_interface_struct (GIArgument *arg, + GIInterfaceInfo *interface_info, + GType g_type, + PyObject *py_type, + GITransfer transfer, + gboolean is_allocated, + gboolean is_foreign); G_END_DECLS @@ -32,6 +32,8 @@ #include <girepository.h> #include "pygi-cache.h" +extern PyObject *PyGIDeprecationWarning; + typedef struct { PyObject_HEAD GIRepository *repository; @@ -45,6 +47,19 @@ typedef struct { } PyGIBaseInfo; typedef struct { + PyGIBaseInfo base; + + /* Reference the unbound version of this struct. + * We use this for the actual call to invoke because it manages the cache. + */ + struct PyGICallableInfo *py_unbound_info; + + /* Holds bound argument for instance, class, and vfunc methods. */ + PyObject *py_bound_arg; + +} PyGICallableInfo; + +typedef struct { PyGPointer base; gboolean free_on_dealloc; } PyGIStruct; diff --git a/gi/repository/Makefile.in b/gi/repository/Makefile.in index 6134f6b..77db58d 100644 --- a/gi/repository/Makefile.in +++ b/gi/repository/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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. @@ -15,23 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + 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@ @@ -51,8 +78,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = gi/repository -DIST_COMMON = $(pygirepository_PYTHON) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(pygirepository_PYTHON) $(top_srcdir)/py-compile 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 \ @@ -65,12 +92,18 @@ 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_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 = \ @@ -107,7 +140,10 @@ am__uninstall_files_from_dir = { \ } am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) am__installdirs = "$(DESTDIR)$(pygirepositorydir)" +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) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ @@ -338,32 +374,38 @@ install-pygirepositoryPYTHON: $(pygirepository_PYTHON) $(INSTALL_DATA) $$files "$(DESTDIR)$(pygirepositorydir)" || exit $$?; \ done || exit $$?; \ if test -n "$$dlist"; then \ - if test -z "$(DESTDIR)"; then \ - $(am__py_compile) --basedir "$(pygirepositorydir)" $$dlist; \ - else \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygirepositorydir)" $$dlist; \ - fi; \ + $(am__py_compile) --destdir "$(DESTDIR)" \ + --basedir "$(pygirepositorydir)" $$dlist; \ else :; fi uninstall-pygirepositoryPYTHON: @$(NORMAL_UNINSTALL) @list='$(pygirepository_PYTHON)'; test -n "$(pygirepositorydir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ + py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$py_files" || exit 0; \ dir='$(DESTDIR)$(pygirepositorydir)'; \ - filesc=`echo "$$files" | sed 's|$$|c|'`; \ - fileso=`echo "$$files" | sed 's|$$|o|'`; \ + 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 "$$files" "$$filesc" "$$fileso"; do \ + 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 -TAGS: +tags TAGS: + +ctags CTAGS: -ctags: CTAGS -CTAGS: +cscope cscopelist: distdir: $(DISTFILES) @@ -503,17 +545,17 @@ uninstall-am: uninstall-pygirepositoryPYTHON .MAKE: check-am install-am install-strip .PHONY: all all-am all-local check check-am check-local clean \ - clean-generic clean-libtool 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-pygirepositoryPYTHON install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-pygirepositoryPYTHON + 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-pygirepositoryPYTHON \ + 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-pygirepositoryPYTHON # if we build in a separate tree, we need to symlink the *.py files from the diff --git a/gi/types.py b/gi/types.py index 47a81d8..7c0f617 100644 --- a/gi/types.py +++ b/gi/types.py @@ -23,6 +23,7 @@ from __future__ import absolute_import import sys +import warnings from . import _gobject from ._gobject._gobject import GInterface @@ -33,12 +34,8 @@ from ._gi import \ ObjectInfo, \ StructInfo, \ VFuncInfo, \ - FunctionInfo, \ register_interface_info, \ - hook_up_vfunc_implementation, \ - DIRECTION_IN, \ - DIRECTION_OUT, \ - DIRECTION_INOUT + hook_up_vfunc_implementation StructInfo # pyflakes @@ -49,115 +46,10 @@ if (3, 0) <= sys.version_info < (3, 3): return hasattr(obj, '__call__') -def split_function_info_args(info): - """Split a functions args into a tuple of two lists. - - Note that args marked as DIRECTION_INOUT will be in both lists. - - :Returns: - Tuple of (in_args, out_args) - """ - in_args = [] - out_args = [] - for arg in info.get_arguments(): - direction = arg.get_direction() - if direction in (DIRECTION_IN, DIRECTION_INOUT): - in_args.append(arg) - if direction in (DIRECTION_OUT, DIRECTION_INOUT): - out_args.append(arg) - return (in_args, out_args) - - -def get_callable_info_doc_string(info): - """Build a signature string which can be used for documentation.""" - in_args, out_args = split_function_info_args(info) - in_args_strs = [] - if isinstance(info, VFuncInfo): - in_args_strs = ['self'] - elif isinstance(info, FunctionInfo): - if info.is_method(): - in_args_strs = ['self'] - elif info.is_constructor(): - in_args_strs = ['cls'] - - for arg in in_args: - argstr = arg.get_name() + ':' + arg.get_pytype_hint() - if arg.is_optional(): - argstr += '=<optional>' - in_args_strs.append(argstr) - in_args_str = ', '.join(in_args_strs) - - if out_args: - out_args_str = ', '.join(arg.get_name() + ':' + arg.get_pytype_hint() - for arg in out_args) - return '%s(%s) -> %s' % (info.get_name(), in_args_str, out_args_str) - else: - return '%s(%s)' % (info.get_name(), in_args_str) - - -def wraps_callable_info(info): - """Similar to functools.wraps but with specific GICallableInfo support.""" - def update_func(func): - func.__info__ = info - func.__name__ = info.get_name() - func.__module__ = 'gi.repository.' + info.get_namespace() - func.__doc__ = get_callable_info_doc_string(info) - return func - return update_func - - -def Function(info): - """Wraps GIFunctionInfo""" - @wraps_callable_info(info) - def function(*args, **kwargs): - return info.invoke(*args, **kwargs) - - return function - - -class NativeVFunc(object): - """Wraps GINativeVFuncInfo""" - def __init__(self, info): - self.__info__ = info - - def __get__(self, instance, klass): - @wraps_callable_info(self.__info__) - def native_vfunc(*args, **kwargs): - return self.__info__.invoke(klass.__gtype__, *args, **kwargs) - return native_vfunc - - -def Constructor(info): - """Wraps GIFunctionInfo with get_constructor() == True""" - @wraps_callable_info(info) - def constructor(cls, *args, **kwargs): - cls_name = info.get_container().get_name() - if cls.__name__ != cls_name: - raise TypeError('%s constructor cannot be used to create instances of a subclass' % cls_name) - return info.invoke(cls, *args, **kwargs) - return constructor - - class MetaClassHelper(object): - - def _setup_constructors(cls): - for method_info in cls.__info__.get_methods(): - if method_info.is_constructor(): - name = method_info.get_name() - constructor = classmethod(Constructor(method_info)) - setattr(cls, name, constructor) - def _setup_methods(cls): for method_info in cls.__info__.get_methods(): - name = method_info.get_name() - function = Function(method_info) - if method_info.is_method(): - method = function - elif method_info.is_constructor(): - continue - else: - method = staticmethod(function) - setattr(cls, name, method) + setattr(cls, method_info.__name__, method_info) def _setup_fields(cls): for field_info in cls.__info__.get_fields(): @@ -182,9 +74,8 @@ class MetaClassHelper(object): vfunc_info = None for base in cls.__mro__: method = getattr(base, vfunc_name, None) - if method is not None and hasattr(method, '__info__') and \ - isinstance(method.__info__, VFuncInfo): - vfunc_info = method.__info__ + if method is not None and isinstance(method, VFuncInfo): + vfunc_info = method break # If we did not find a matching method name in the bases, we might @@ -231,9 +122,8 @@ class MetaClassHelper(object): return for vfunc_info in class_info.get_vfuncs(): - name = 'do_%s' % vfunc_info.get_name() - value = NativeVFunc(vfunc_info) - setattr(cls, name, value) + name = 'do_%s' % vfunc_info.__name__ + setattr(cls, name, vfunc_info) def find_vfunc_info_in_interface(bases, vfunc_name): @@ -300,7 +190,6 @@ class GObjectMeta(_gobject.GObjectMeta, MetaClassHelper): if isinstance(cls.__info__, ObjectInfo): cls._setup_fields() - cls._setup_constructors() elif isinstance(cls.__info__, InterfaceInfo): register_interface_info(cls.__info__.get_g_type()) @@ -309,17 +198,40 @@ class GObjectMeta(_gobject.GObjectMeta, MetaClassHelper): def mro(C): - """Compute the class precedence list (mro) according to C3 + """Compute the class precedence list (mro) according to C3, with GObject + interface considerations. + + We override Python's MRO calculation to account for the fact that + GObject classes are not affected by the diamond problem: + http://en.wikipedia.org/wiki/Diamond_problem Based on http://www.python.org/download/releases/2.3/mro/ - Modified to consider that interfaces don't create the diamond problem """ # TODO: If this turns out being too slow, consider using generators bases = [] bases_of_subclasses = [[C]] if C.__bases__: - bases_of_subclasses += list(map(mro, C.__bases__)) + [list(C.__bases__)] + for base in C.__bases__: + # Python causes MRO's to be calculated starting with the lowest + # base class and working towards the descendant, storing the result + # in __mro__ at each point. Therefore at this point we know that + # we already have our base class MRO's available to us, there is + # no need for us to (re)calculate them. + if hasattr(base, '__mro__'): + bases_of_subclasses += [list(base.__mro__)] + else: + warnings.warn('Mixin class %s is an old style class, please ' + 'update this to derive from "object".' % base, + RuntimeWarning) + # For old-style classes (Python2 only), the MRO is not + # easily accessible. As we do need it here, we calculate + # it via recursion, according to the C3 algorithm. Using C3 + # for old style classes deviates from Python's own behaviour, + # but visible effects here would be a corner case triggered by + # questionable design. + bases_of_subclasses += [mro(base)] + bases_of_subclasses += [list(C.__bases__)] while bases_of_subclasses: for subclass_bases in bases_of_subclasses: @@ -357,11 +269,10 @@ class StructMeta(type, MetaClassHelper): cls._setup_fields() cls._setup_methods() - cls._setup_constructors() for method_info in cls.__info__.get_methods(): if method_info.is_constructor() and \ - method_info.get_name() == 'new' and \ + method_info.__name__ == 'new' and \ not method_info.get_arguments(): - cls.__new__ = staticmethod(Constructor(method_info)) + cls.__new__ = staticmethod(method_info) break @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2011-01-19.21; # UTC +scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it +# 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written @@ -156,7 +156,7 @@ while test $# -ne 0; do -s) stripcmd=$stripprog;; -t) dst_arg=$2 - # Protect names problematic for `test' and other utilities. + # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac @@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then fi shift # arg dst_arg=$arg - # Protect names problematic for `test' and other utilities. + # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac @@ -202,7 +202,7 @@ if test $# -eq 0; then echo "$0: no input file specified." >&2 exit 1 fi - # It's OK to call `install-sh -d' without argument. + # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi @@ -240,7 +240,7 @@ fi for src do - # Protect names problematic for `test' and other utilities. + # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac @@ -354,7 +354,7 @@ do if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. + # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in @@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.3ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1" +VERSION="2.4.2 Debian-2.4.2-1.3ubuntu1" TIMESTAMP="" package_revision=1.3337 @@ -1,11 +1,10 @@ #! /bin/sh -# Common stub for a few missing GNU programs while installing. +# Common wrapper for a few potentially missing GNU programs. -scriptversion=2012-01-06.13; # UTC +scriptversion=2012-06-26.16; # UTC -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # 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 @@ -26,68 +25,40 @@ scriptversion=2012-01-06.13; # UTC # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" + echo 1>&2 "Try '$0 --help' for more information" exit 1 fi -run=: -sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' -sed_minuso='s/.* -o \([^ ]*\).*/\1/p' - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi +case $1 in -msg="missing on your system" + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; -case $1 in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - autom4te touch the output file, or create a stub one - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - yacc create \`y.tab.[ch]', if possible, from existing .[ch] + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man -Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and -\`g' are ignored when checking the name. +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. Send bug reports to <bug-automake@gnu.org>." exit $? @@ -99,228 +70,141 @@ Send bug reports to <bug-automake@gnu.org>." ;; -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac -# normalize program name to check for. -program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). This is about non-GNU programs, so use $1 not -# $program. -case $1 in - lex*|yacc*) - # Not GNU programs, they don't have --version. - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case $program in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case $f in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te*) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison*|yacc*) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if test $# -ne 1; then - eval LASTARG=\${$#} - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -f y.tab.c; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex*|flex*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if test $# -ne 1; then - eval LASTARG=\${$#} - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -f lex.yy.c; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit $? - fi - ;; - - makeinfo*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \([^ ]*\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 +perl_URL=http://www.perl.org/ +flex_URL=http://flex.sourceforge.net/ +gnu_software_URL=http://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'automa4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" ;; -esac - -exit 0 + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) @@ -3,8 +3,7 @@ scriptversion=2011-06-08.12; # UTC -# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009, 2011 Free -# Software Foundation, Inc. +# Copyright (C) 2000-2013 Free Software Foundation, Inc. # 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 @@ -37,7 +36,7 @@ me=py-compile usage_error () { echo "$me: $*" >&2 - echo "Try \`$me --help' for more information." >&2 + echo "Try '$me --help' for more information." >&2 exit 1 } @@ -117,7 +116,7 @@ else fi $PYTHON -c " -import sys, os, py_compile +import sys, os, py_compile, imp files = '''$files''' @@ -130,12 +129,19 @@ for file in files.split(): continue sys.stdout.write(file) sys.stdout.flush() - py_compile.compile(filepath, filepath + 'c', path) + if hasattr(imp, 'get_tag'): + py_compile.compile(filepath, imp.cache_from_source(filepath), path) + else: + py_compile.compile(filepath, filepath + 'c', path) sys.stdout.write('\n')" || exit $? # this will fail for python < 1.5, but that doesn't matter ... $PYTHON -O -c " -import sys, os, py_compile +import sys, os, py_compile, imp + +# pypy does not use .pyo optimization +if hasattr(sys, 'pypy_translation_info'): + sys.exit(0) files = '''$files''' sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n') @@ -147,7 +153,10 @@ for file in files.split(): continue sys.stdout.write(file) sys.stdout.flush() - py_compile.compile(filepath, filepath + 'o', path) + if hasattr(imp, 'get_tag'): + py_compile.compile(filepath, imp.cache_from_source(filepath, False), path) + else: + py_compile.compile(filepath, filepath + 'o', path) sys.stdout.write('\n')" 2>/dev/null || : # Local Variables: diff --git a/pygtkcompat/Makefile.in b/pygtkcompat/Makefile.in index 255c924..2505c34 100644 --- a/pygtkcompat/Makefile.in +++ b/pygtkcompat/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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. @@ -15,23 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + 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@ @@ -51,8 +78,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = pygtkcompat -DIST_COMMON = $(pygtkcompat_PYTHON) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(pygtkcompat_PYTHON) $(top_srcdir)/py-compile 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 \ @@ -65,12 +92,18 @@ 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_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 = \ @@ -107,7 +140,10 @@ am__uninstall_files_from_dir = { \ } am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) am__installdirs = "$(DESTDIR)$(pygtkcompatdir)" +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) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ @@ -340,32 +376,38 @@ install-pygtkcompatPYTHON: $(pygtkcompat_PYTHON) $(INSTALL_DATA) $$files "$(DESTDIR)$(pygtkcompatdir)" || exit $$?; \ done || exit $$?; \ if test -n "$$dlist"; then \ - if test -z "$(DESTDIR)"; then \ - $(am__py_compile) --basedir "$(pygtkcompatdir)" $$dlist; \ - else \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygtkcompatdir)" $$dlist; \ - fi; \ + $(am__py_compile) --destdir "$(DESTDIR)" \ + --basedir "$(pygtkcompatdir)" $$dlist; \ else :; fi uninstall-pygtkcompatPYTHON: @$(NORMAL_UNINSTALL) @list='$(pygtkcompat_PYTHON)'; test -n "$(pygtkcompatdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ + py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$py_files" || exit 0; \ dir='$(DESTDIR)$(pygtkcompatdir)'; \ - filesc=`echo "$$files" | sed 's|$$|c|'`; \ - fileso=`echo "$$files" | sed 's|$$|o|'`; \ + 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 "$$files" "$$filesc" "$$fileso"; do \ + 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 -TAGS: +tags TAGS: + +ctags CTAGS: -ctags: CTAGS -CTAGS: +cscope cscopelist: distdir: $(DISTFILES) @@ -504,17 +546,17 @@ uninstall-am: uninstall-pygtkcompatPYTHON .MAKE: install-am install-strip .PHONY: all all-am all-local check check-am clean clean-generic \ - clean-libtool 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-pygtkcompatPYTHON install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-pygtkcompatPYTHON + 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-pygtkcompatPYTHON \ + 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-pygtkcompatPYTHON # if we build in a separate tree, we need to symlink the *.py files from the diff --git a/pygtkcompat/pygtkcompat.py b/pygtkcompat/pygtkcompat.py index 4267a60..67571ac 100644 --- a/pygtkcompat/pygtkcompat.py +++ b/pygtkcompat/pygtkcompat.py @@ -139,7 +139,10 @@ def enable_gtk(version='3.0'): Gdk.PixbufLoader = GdkPixbuf.PixbufLoader.new_with_type Gdk.pixbuf_new_from_data = GdkPixbuf.Pixbuf.new_from_data Gdk.pixbuf_new_from_file = GdkPixbuf.Pixbuf.new_from_file - Gdk.pixbuf_new_from_file_at_scale = GdkPixbuf.Pixbuf.new_from_file_at_scale + try: + Gdk.pixbuf_new_from_file_at_scale = GdkPixbuf.Pixbuf.new_from_file_at_scale + except AttributeError: + pass Gdk.pixbuf_new_from_file_at_size = GdkPixbuf.Pixbuf.new_from_file_at_size Gdk.pixbuf_new_from_inline = GdkPixbuf.Pixbuf.new_from_inline Gdk.pixbuf_new_from_stream = GdkPixbuf.Pixbuf.new_from_stream @@ -349,7 +352,10 @@ def enable_gtk(version='3.0'): Gtk.image_new_from_file = Gtk.Image.new_from_file Gtk.settings_get_default = Gtk.Settings.get_default Gtk.window_set_default_icon = Gtk.Window.set_default_icon - Gtk.clipboard_get = Gtk.Clipboard.get + try: + Gtk.clipboard_get = Gtk.Clipboard.get + except AttributeError: + pass #AccelGroup Gtk.AccelGroup.connect_group = Gtk.AccelGroup.connect diff --git a/tests/Makefile.am b/tests/Makefile.am index 7062aa7..b845e4b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -109,6 +109,7 @@ EXTRA_DIST = \ test_overrides_gtk.py \ test_atoms.py \ test_generictreemodel.py \ + test_docstring.py \ compat_test_pygtk.py \ gi/__init__.py \ gi/overrides/__init__.py \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 77dbc14..4fe6fd6 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 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. @@ -15,23 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +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 \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + 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; \ - test $$am__dry = yes; \ - } + 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@ @@ -55,7 +82,8 @@ host_triplet = @host@ @ENABLE_CAIRO_TRUE@am__append_1 = libregress.la @ENABLE_CAIRO_TRUE@am__append_2 = Regress-1.0.typelib subdir = tests -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp 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 \ @@ -76,6 +104,7 @@ libgimarshallingtests_la_OBJECTS = \ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = libgimarshallingtests_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libgimarshallingtests_la_CFLAGS) $(CFLAGS) \ @@ -97,6 +126,18 @@ testhelper_la_OBJECTS = $(am_testhelper_la_OBJECTS) testhelper_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testhelper_la_CFLAGS) \ $(CFLAGS) $(testhelper_la_LDFLAGS) $(LDFLAGS) -o $@ +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 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -109,20 +150,16 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -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_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(nodist_libgimarshallingtests_la_SOURCES) \ $(nodist_libregress_la_SOURCES) $(testhelper_la_SOURCES) DIST_SOURCES = $(testhelper_la_SOURCES) @@ -131,6 +168,23 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -355,6 +409,7 @@ EXTRA_DIST = \ test_overrides_gtk.py \ test_atoms.py \ test_generictreemodel.py \ + test_docstring.py \ compat_test_pygtk.py \ gi/__init__.py \ gi/overrides/__init__.py \ @@ -409,12 +464,15 @@ $(am__aclocal_m4_deps): clean-checkLTLIBRARIES: -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES) - @list='$(check_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(check_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + 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) @@ -500,26 +558,15 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -531,15 +578,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -548,6 +591,21 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -692,19 +750,19 @@ uninstall-am: .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ clean-checkLTLIBRARIES clean-generic clean-libtool clean-local \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am + tags tags-am uninstall uninstall-am # This is a hack to make sure a shared library is built diff --git a/tests/test_docstring.py b/tests/test_docstring.py new file mode 100644 index 0000000..1628295 --- /dev/null +++ b/tests/test_docstring.py @@ -0,0 +1,49 @@ +import unittest + +import gi.docstring +from gi.repository import GIMarshallingTests + + +class Test(unittest.TestCase): + def test_api(self): + new_func = lambda info: 'docstring test' + old_func = gi.docstring.get_doc_string_generator() + + gi.docstring.set_doc_string_generator(new_func) + self.assertEqual(gi.docstring.get_doc_string_generator(), + new_func) + self.assertEqual(gi.docstring.generate_doc_string(None), + 'docstring test') + + # Set back to original generator + gi.docstring.set_doc_string_generator(old_func) + self.assertEqual(gi.docstring.get_doc_string_generator(), + old_func) + + def test_split_args_multi_out(self): + in_args, out_args = gi.docstring.split_function_info_args(GIMarshallingTests.int_out_out) + self.assertEqual(len(in_args), 0) + self.assertEqual(len(out_args), 2) + self.assertEqual(out_args[0].get_pytype_hint(), 'int') + self.assertEqual(out_args[1].get_pytype_hint(), 'int') + + def test_split_args_inout(self): + in_args, out_args = gi.docstring.split_function_info_args(GIMarshallingTests.long_inout_max_min) + self.assertEqual(len(in_args), 1) + self.assertEqual(len(out_args), 1) + self.assertEqual(in_args[0].get_name(), out_args[0].get_name()) + self.assertEqual(in_args[0].get_pytype_hint(), out_args[0].get_pytype_hint()) + + def test_split_args_none(self): + obj = GIMarshallingTests.Object(int=33) + in_args, out_args = gi.docstring.split_function_info_args(obj.none_inout) + self.assertEqual(len(in_args), 1) + self.assertEqual(len(out_args), 1) + + def test_final_signature_with_full_inout(self): + self.assertEqual(GIMarshallingTests.Object.full_inout.__doc__, + 'full_inout(object:GIMarshallingTests.Object) -> object:GIMarshallingTests.Object') + + def test_overridden_doc_is_not_clobbered(self): + self.assertEqual(GIMarshallingTests.OverridesObject.method.__doc__, + 'Overridden doc string.') diff --git a/tests/test_everything.py b/tests/test_everything.py index 87b3d2b..b2f0528 100644 --- a/tests/test_everything.py +++ b/tests/test_everything.py @@ -94,108 +94,108 @@ class TestEverything(unittest.TestCase): GObject.G_MAXINT8) self.assertEqual(Everything.test_int8(GObject.G_MININT8), GObject.G_MININT8) - self.assertRaises(ValueError, Everything.test_int8, GObject.G_MAXINT8 + 1) + self.assertRaises(OverflowError, Everything.test_int8, GObject.G_MAXINT8 + 1) self.assertEqual(Everything.test_uint8(GObject.G_MAXUINT8), GObject.G_MAXUINT8) self.assertEqual(Everything.test_uint8(0), 0) - self.assertRaises(ValueError, Everything.test_uint8, -1) - self.assertRaises(ValueError, Everything.test_uint8, GObject.G_MAXUINT8 + 1) + self.assertRaises(OverflowError, Everything.test_uint8, -1) + self.assertRaises(OverflowError, Everything.test_uint8, GObject.G_MAXUINT8 + 1) def test_int16(self): self.assertEqual(Everything.test_int16(GObject.G_MAXINT16), GObject.G_MAXINT16) self.assertEqual(Everything.test_int16(GObject.G_MININT16), GObject.G_MININT16) - self.assertRaises(ValueError, Everything.test_int16, GObject.G_MAXINT16 + 1) + self.assertRaises(OverflowError, Everything.test_int16, GObject.G_MAXINT16 + 1) self.assertEqual(Everything.test_uint16(GObject.G_MAXUINT16), GObject.G_MAXUINT16) self.assertEqual(Everything.test_uint16(0), 0) - self.assertRaises(ValueError, Everything.test_uint16, -1) - self.assertRaises(ValueError, Everything.test_uint16, GObject.G_MAXUINT16 + 1) + self.assertRaises(OverflowError, Everything.test_uint16, -1) + self.assertRaises(OverflowError, Everything.test_uint16, GObject.G_MAXUINT16 + 1) def test_int32(self): self.assertEqual(Everything.test_int32(GObject.G_MAXINT32), GObject.G_MAXINT32) self.assertEqual(Everything.test_int32(GObject.G_MININT32), GObject.G_MININT32) - self.assertRaises(ValueError, Everything.test_int32, GObject.G_MAXINT32 + 1) + self.assertRaises(OverflowError, Everything.test_int32, GObject.G_MAXINT32 + 1) self.assertEqual(Everything.test_uint32(GObject.G_MAXUINT32), GObject.G_MAXUINT32) self.assertEqual(Everything.test_uint32(0), 0) - self.assertRaises(ValueError, Everything.test_uint32, -1) - self.assertRaises(ValueError, Everything.test_uint32, GObject.G_MAXUINT32 + 1) + self.assertRaises(OverflowError, Everything.test_uint32, -1) + self.assertRaises(OverflowError, Everything.test_uint32, GObject.G_MAXUINT32 + 1) def test_int64(self): self.assertEqual(Everything.test_int64(GObject.G_MAXINT64), GObject.G_MAXINT64) self.assertEqual(Everything.test_int64(GObject.G_MININT64), GObject.G_MININT64) - self.assertRaises(ValueError, Everything.test_int64, GObject.G_MAXINT64 + 1) + self.assertRaises(OverflowError, Everything.test_int64, GObject.G_MAXINT64 + 1) self.assertEqual(Everything.test_uint64(GObject.G_MAXUINT64), GObject.G_MAXUINT64) self.assertEqual(Everything.test_uint64(0), 0) - self.assertRaises(ValueError, Everything.test_uint64, -1) - self.assertRaises(ValueError, Everything.test_uint64, GObject.G_MAXUINT64 + 1) + self.assertRaises(OverflowError, Everything.test_uint64, -1) + self.assertRaises(OverflowError, Everything.test_uint64, GObject.G_MAXUINT64 + 1) def test_int(self): self.assertEqual(Everything.test_int(GObject.G_MAXINT), GObject.G_MAXINT) self.assertEqual(Everything.test_int(GObject.G_MININT), GObject.G_MININT) - self.assertRaises(ValueError, Everything.test_int, GObject.G_MAXINT + 1) + self.assertRaises(OverflowError, Everything.test_int, GObject.G_MAXINT + 1) self.assertEqual(Everything.test_uint(GObject.G_MAXUINT), GObject.G_MAXUINT) self.assertEqual(Everything.test_uint(0), 0) - self.assertRaises(ValueError, Everything.test_uint, -1) - self.assertRaises(ValueError, Everything.test_uint, GObject.G_MAXUINT + 1) + self.assertRaises(OverflowError, Everything.test_uint, -1) + self.assertRaises(OverflowError, Everything.test_uint, GObject.G_MAXUINT + 1) def test_short(self): self.assertEqual(Everything.test_short(GObject.G_MAXSHORT), GObject.G_MAXSHORT) self.assertEqual(Everything.test_short(GObject.G_MINSHORT), GObject.G_MINSHORT) - self.assertRaises(ValueError, Everything.test_short, GObject.G_MAXSHORT + 1) + self.assertRaises(OverflowError, Everything.test_short, GObject.G_MAXSHORT + 1) self.assertEqual(Everything.test_ushort(GObject.G_MAXUSHORT), GObject.G_MAXUSHORT) self.assertEqual(Everything.test_ushort(0), 0) - self.assertRaises(ValueError, Everything.test_ushort, -1) - self.assertRaises(ValueError, Everything.test_ushort, GObject.G_MAXUSHORT + 1) + self.assertRaises(OverflowError, Everything.test_ushort, -1) + self.assertRaises(OverflowError, Everything.test_ushort, GObject.G_MAXUSHORT + 1) def test_long(self): self.assertEqual(Everything.test_long(GObject.G_MAXLONG), GObject.G_MAXLONG) self.assertEqual(Everything.test_long(GObject.G_MINLONG), GObject.G_MINLONG) - self.assertRaises(ValueError, Everything.test_long, GObject.G_MAXLONG + 1) + self.assertRaises(OverflowError, Everything.test_long, GObject.G_MAXLONG + 1) self.assertEqual(Everything.test_ulong(GObject.G_MAXULONG), GObject.G_MAXULONG) self.assertEqual(Everything.test_ulong(0), 0) - self.assertRaises(ValueError, Everything.test_ulong, -1) - self.assertRaises(ValueError, Everything.test_ulong, GObject.G_MAXULONG + 1) + self.assertRaises(OverflowError, Everything.test_ulong, -1) + self.assertRaises(OverflowError, Everything.test_ulong, GObject.G_MAXULONG + 1) def test_size(self): self.assertEqual(Everything.test_ssize(GObject.G_MAXSSIZE), GObject.G_MAXSSIZE) self.assertEqual(Everything.test_ssize(GObject.G_MINSSIZE), GObject.G_MINSSIZE) - self.assertRaises(ValueError, Everything.test_ssize, GObject.G_MAXSSIZE + 1) + self.assertRaises(OverflowError, Everything.test_ssize, GObject.G_MAXSSIZE + 1) self.assertEqual(Everything.test_size(GObject.G_MAXSIZE), GObject.G_MAXSIZE) self.assertEqual(Everything.test_size(0), 0) - self.assertRaises(ValueError, Everything.test_size, -1) - self.assertRaises(ValueError, Everything.test_size, GObject.G_MAXSIZE + 1) + self.assertRaises(OverflowError, Everything.test_size, -1) + self.assertRaises(OverflowError, Everything.test_size, GObject.G_MAXSIZE + 1) def test_timet(self): self.assertEqual(Everything.test_timet(42), 42) - self.assertRaises(ValueError, Everything.test_timet, GObject.G_MAXUINT64 + 1) + self.assertRaises(OverflowError, Everything.test_timet, GObject.G_MAXUINT64 + 1) def test_unichar(self): self.assertEqual("c", Everything.test_unichar("c")) @@ -211,7 +211,7 @@ class TestEverything(unittest.TestCase): GObject.G_MAXFLOAT) self.assertEqual(Everything.test_float(GObject.G_MINFLOAT), GObject.G_MINFLOAT) - self.assertRaises(ValueError, Everything.test_float, GObject.G_MAXFLOAT * 2) + self.assertRaises(OverflowError, Everything.test_float, GObject.G_MAXFLOAT * 2) def test_double(self): self.assertEqual(Everything.test_double(GObject.G_MAXDOUBLE), @@ -480,17 +480,15 @@ class TestEverything(unittest.TestCase): self.assertEqual(Everything.test_ghash_nested_everything_return2(), {}) def test_hash_in(self): - # specifying a simple string array for "strings" does not work due to - # https://bugzilla.gnome.org/show_bug.cgi?id=666636 - # workaround by explicitly building a GStrv object - class GStrv(list): - __gtype__ = GObject.TYPE_STRV - expected = {'foo': 'bar', 'baz': 'bat', 'qux': 'quux'} Everything.test_ghash_nothing_in(expected) Everything.test_ghash_nothing_in2(expected) + def test_hash_in_with_typed_strv(self): + class GStrv(list): + __gtype__ = GObject.TYPE_STRV + data = {'integer': 12, 'boolean': True, 'string': 'some text', @@ -501,6 +499,17 @@ class TestEverything(unittest.TestCase): Everything.test_ghash_gvalue_in(data) data = None + def test_hash_in_with_gvalue_strv(self): + data = {'integer': 12, + 'boolean': True, + 'string': 'some text', + 'strings': GObject.Value(GObject.TYPE_STRV, ['first', 'second', 'third']), + 'flags': Everything.TestFlags.FLAG1 | Everything.TestFlags.FLAG3, + 'enum': Everything.TestEnum.VALUE2, + } + Everything.test_ghash_gvalue_in(data) + data = None + def test_struct_gpointer(self): glist = GLib.List() raw = RawGList.from_wrapped(glist) diff --git a/tests/test_generictreemodel.py b/tests/test_generictreemodel.py index ff0f523..9fa89ff 100644 --- a/tests/test_generictreemodel.py +++ b/tests/test_generictreemodel.py @@ -314,12 +314,12 @@ class ExceptHook(object): are never bubbled through from python to C back to python. This works because exception hooks are called in PyErr_Print. """ - def __init__(self, exc_type): - self._exc_type = exc_type + def __init__(self, *expected_exc_types): + self._expected_exc_types = expected_exc_types self._exceptions = [] def _excepthook(self, exc_type, value, traceback): - self._exceptions.append(exc_type) + self._exceptions.append((exc_type, value)) def __enter__(self): self._oldhook = sys.excepthook @@ -328,8 +328,13 @@ class ExceptHook(object): def __exit__(self, exc_type, exc_val, exc_tb): sys.excepthook = self._oldhook - assert len(self._exceptions) == 1, 'Expecting exactly one exception of type %s' % self._exc_type - assert issubclass(self._exceptions[0], self._exc_type), 'Expecting exactly one exception of type %s' % self._exc_type + error_message = 'Expecting the following exceptions: %s, got: %s' % \ + (str(self._expected_exc_types), '\n'.join([str(item) for item in self._exceptions])) + + assert len(self._expected_exc_types) == len(self._exceptions), error_message + + for expected, got in zip(self._expected_exc_types, [exc[0] for exc in self._exceptions]): + assert issubclass(got, expected), error_message class TestReturnsAfterError(unittest.TestCase): @@ -347,7 +352,7 @@ class TestReturnsAfterError(unittest.TestCase): self.assertEqual(count, 0) def test_get_column_type(self): - with ExceptHook(NotImplementedError): + with ExceptHook(NotImplementedError, TypeError): col_type = self.model.get_column_type(0) self.assertEqual(col_type, GObject.TYPE_INVALID) diff --git a/tests/test_gi.py b/tests/test_gi.py index 1c983eb..c47ac57 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -117,8 +117,8 @@ class TestInt8(unittest.TestCase): max.value += 1 min.value -= 1 - self.assertRaises(ValueError, GIMarshallingTests.int8_in_max, max) - self.assertRaises(ValueError, GIMarshallingTests.int8_in_min, min) + self.assertRaises(OverflowError, GIMarshallingTests.int8_in_max, max) + self.assertRaises(OverflowError, GIMarshallingTests.int8_in_min, min) self.assertRaises(TypeError, GIMarshallingTests.int8_in_max, "self.MAX") @@ -145,8 +145,8 @@ class TestUInt8(unittest.TestCase): GIMarshallingTests.uint8_in(CHAR_255) number.value += 1 - self.assertRaises(ValueError, GIMarshallingTests.uint8_in, number) - self.assertRaises(ValueError, GIMarshallingTests.uint8_in, Number(-1)) + self.assertRaises(OverflowError, GIMarshallingTests.uint8_in, number) + self.assertRaises(OverflowError, GIMarshallingTests.uint8_in, Number(-1)) self.assertRaises(TypeError, GIMarshallingTests.uint8_in, "self.MAX") @@ -176,8 +176,8 @@ class TestInt16(unittest.TestCase): max.value += 1 min.value -= 1 - self.assertRaises(ValueError, GIMarshallingTests.int16_in_max, max) - self.assertRaises(ValueError, GIMarshallingTests.int16_in_min, min) + self.assertRaises(OverflowError, GIMarshallingTests.int16_in_max, max) + self.assertRaises(OverflowError, GIMarshallingTests.int16_in_min, min) self.assertRaises(TypeError, GIMarshallingTests.int16_in_max, "self.MAX") @@ -204,8 +204,8 @@ class TestUInt16(unittest.TestCase): number.value += 1 - self.assertRaises(ValueError, GIMarshallingTests.uint16_in, number) - self.assertRaises(ValueError, GIMarshallingTests.uint16_in, Number(-1)) + self.assertRaises(OverflowError, GIMarshallingTests.uint16_in, number) + self.assertRaises(OverflowError, GIMarshallingTests.uint16_in, Number(-1)) self.assertRaises(TypeError, GIMarshallingTests.uint16_in, "self.MAX") @@ -235,8 +235,8 @@ class TestInt32(unittest.TestCase): max.value += 1 min.value -= 1 - self.assertRaises(ValueError, GIMarshallingTests.int32_in_max, max) - self.assertRaises(ValueError, GIMarshallingTests.int32_in_min, min) + self.assertRaises(OverflowError, GIMarshallingTests.int32_in_max, max) + self.assertRaises(OverflowError, GIMarshallingTests.int32_in_min, min) self.assertRaises(TypeError, GIMarshallingTests.int32_in_max, "self.MAX") @@ -263,8 +263,8 @@ class TestUInt32(unittest.TestCase): number.value += 1 - self.assertRaises(ValueError, GIMarshallingTests.uint32_in, number) - self.assertRaises(ValueError, GIMarshallingTests.uint32_in, Number(-1)) + self.assertRaises(OverflowError, GIMarshallingTests.uint32_in, number) + self.assertRaises(OverflowError, GIMarshallingTests.uint32_in, Number(-1)) self.assertRaises(TypeError, GIMarshallingTests.uint32_in, "self.MAX") @@ -294,8 +294,8 @@ class TestInt64(unittest.TestCase): max.value += 1 min.value -= 1 - self.assertRaises(ValueError, GIMarshallingTests.int64_in_max, max) - self.assertRaises(ValueError, GIMarshallingTests.int64_in_min, min) + self.assertRaises(OverflowError, GIMarshallingTests.int64_in_max, max) + self.assertRaises(OverflowError, GIMarshallingTests.int64_in_min, min) self.assertRaises(TypeError, GIMarshallingTests.int64_in_max, "self.MAX") @@ -322,8 +322,8 @@ class TestUInt64(unittest.TestCase): number.value += 1 - self.assertRaises(ValueError, GIMarshallingTests.uint64_in, number) - self.assertRaises(ValueError, GIMarshallingTests.uint64_in, Number(-1)) + self.assertRaises(OverflowError, GIMarshallingTests.uint64_in, number) + self.assertRaises(OverflowError, GIMarshallingTests.uint64_in, Number(-1)) self.assertRaises(TypeError, GIMarshallingTests.uint64_in, "self.MAX") @@ -353,8 +353,8 @@ class TestShort(unittest.TestCase): max.value += 1 min.value -= 1 - self.assertRaises(ValueError, GIMarshallingTests.short_in_max, max) - self.assertRaises(ValueError, GIMarshallingTests.short_in_min, min) + self.assertRaises(OverflowError, GIMarshallingTests.short_in_max, max) + self.assertRaises(OverflowError, GIMarshallingTests.short_in_min, min) self.assertRaises(TypeError, GIMarshallingTests.short_in_max, "self.MAX") @@ -381,8 +381,8 @@ class TestUShort(unittest.TestCase): number.value += 1 - self.assertRaises(ValueError, GIMarshallingTests.ushort_in, number) - self.assertRaises(ValueError, GIMarshallingTests.ushort_in, Number(-1)) + self.assertRaises(OverflowError, GIMarshallingTests.ushort_in, number) + self.assertRaises(OverflowError, GIMarshallingTests.ushort_in, Number(-1)) self.assertRaises(TypeError, GIMarshallingTests.ushort_in, "self.MAX") @@ -412,8 +412,8 @@ class TestInt(unittest.TestCase): max.value += 1 min.value -= 1 - self.assertRaises(ValueError, GIMarshallingTests.int_in_max, max) - self.assertRaises(ValueError, GIMarshallingTests.int_in_min, min) + self.assertRaises(OverflowError, GIMarshallingTests.int_in_max, max) + self.assertRaises(OverflowError, GIMarshallingTests.int_in_min, min) self.assertRaises(TypeError, GIMarshallingTests.int_in_max, "self.MAX") @@ -441,8 +441,8 @@ class TestUInt(unittest.TestCase): number.value += 1 - self.assertRaises(ValueError, GIMarshallingTests.uint_in, number) - self.assertRaises(ValueError, GIMarshallingTests.uint_in, Number(-1)) + self.assertRaises(OverflowError, GIMarshallingTests.uint_in, number) + self.assertRaises(OverflowError, GIMarshallingTests.uint_in, Number(-1)) self.assertRaises(TypeError, GIMarshallingTests.uint_in, "self.MAX") @@ -472,8 +472,8 @@ class TestLong(unittest.TestCase): max.value += 1 min.value -= 1 - self.assertRaises(ValueError, GIMarshallingTests.long_in_max, max) - self.assertRaises(ValueError, GIMarshallingTests.long_in_min, min) + self.assertRaises(OverflowError, GIMarshallingTests.long_in_max, max) + self.assertRaises(OverflowError, GIMarshallingTests.long_in_min, min) self.assertRaises(TypeError, GIMarshallingTests.long_in_max, "self.MAX") @@ -500,8 +500,8 @@ class TestULong(unittest.TestCase): number.value += 1 - self.assertRaises(ValueError, GIMarshallingTests.ulong_in, number) - self.assertRaises(ValueError, GIMarshallingTests.ulong_in, Number(-1)) + self.assertRaises(OverflowError, GIMarshallingTests.ulong_in, number) + self.assertRaises(OverflowError, GIMarshallingTests.ulong_in, Number(-1)) self.assertRaises(TypeError, GIMarshallingTests.ulong_in, "self.MAX") @@ -531,8 +531,8 @@ class TestSSize(unittest.TestCase): max.value += 1 min.value -= 1 - self.assertRaises(ValueError, GIMarshallingTests.ssize_in_max, max) - self.assertRaises(ValueError, GIMarshallingTests.ssize_in_min, min) + self.assertRaises(OverflowError, GIMarshallingTests.ssize_in_max, max) + self.assertRaises(OverflowError, GIMarshallingTests.ssize_in_min, min) self.assertRaises(TypeError, GIMarshallingTests.ssize_in_max, "self.MAX") @@ -559,8 +559,8 @@ class TestSize(unittest.TestCase): number.value += 1 - self.assertRaises(ValueError, GIMarshallingTests.size_in, number) - self.assertRaises(ValueError, GIMarshallingTests.size_in, Number(-1)) + self.assertRaises(OverflowError, GIMarshallingTests.size_in, number) + self.assertRaises(OverflowError, GIMarshallingTests.size_in, Number(-1)) self.assertRaises(TypeError, GIMarshallingTests.size_in, "self.MAX") @@ -1219,6 +1219,13 @@ class TestGValue(unittest.TestCase): value = GObject.Value(GObject.TYPE_INT, 42) GIMarshallingTests.gvalue_in(value) + @unittest.skipUnless(hasattr(GIMarshallingTests, 'gvalue_in_with_modification'), + 'Newer version of gi needed.') + def test_gvalue_in_with_modification(self): + value = GObject.Value(GObject.TYPE_INT, 42) + GIMarshallingTests.gvalue_in_with_modification(value) + self.assertEqual(value.get_int(), 24) + def test_gvalue_int64_in(self): value = GObject.Value(GObject.TYPE_INT64, GObject.G_MAXINT64) GIMarshallingTests.gvalue_int64_in(value) @@ -2069,6 +2076,10 @@ class TestPythonGObject(unittest.TestCase): self.variants = variants self.n_variants = n_variants + class ErrorObject(GIMarshallingTests.Object): + def do_vfunc_return_value_only(self): + raise ValueError('Return value should be 0') + def test_object(self): self.assertTrue(issubclass(self.Object, GIMarshallingTests.Object)) @@ -2141,7 +2152,7 @@ class TestPythonGObject(unittest.TestCase): self.assertTrue(isinstance(GObject, DynamicModule)) def test_subobject_non_vfunc_do_method(self): - class PythonObjectWithNonVFuncDoMethod: + class PythonObjectWithNonVFuncDoMethod(object): def do_not_a_vfunc(self): return 5 @@ -2228,6 +2239,10 @@ class TestPythonGObject(unittest.TestCase): _object.call_vfunc_with_callback() self.assertTrue(_object.worked) + def test_exception_in_vfunc_return_value(self): + obj = self.ErrorObject() + self.assertEqual(obj.vfunc_return_value_only(), 0) + class TestMultiOutputArgs(unittest.TestCase): @@ -2292,22 +2307,6 @@ class TestInterfaces(unittest.TestCase): self.assertEqual(instance.val, None) self.assertEqual(instance.val2, 42) - def test_mro(self): - # there was a problem with Python bailing out because of - # http://en.wikipedia.org/wiki/Diamond_problem with interfaces, - # which shouldn't really be a problem. - - class TestInterfaceImpl(GObject.GObject, GIMarshallingTests.Interface): - pass - - class TestInterfaceImpl2(GIMarshallingTests.Interface, - TestInterfaceImpl): - pass - - class TestInterfaceImpl3(self.TestInterfaceImpl, - GIMarshallingTests.Interface2): - pass - def test_type_mismatch(self): obj = GIMarshallingTests.Object() @@ -2330,16 +2329,12 @@ class TestInterfaces(unittest.TestCase): Gio.FileEnumerator.next_file(obj, None) self.fail('call with wrong type argument unexpectedly succeeded') except TypeError as e: - if sys.version_info < (3, 0): - self.assertTrue('FileEnumerator' in str(e), e) - self.assertTrue('Object' in str(e), e) - else: - # should have argument name - self.assertTrue('self' in str(e), e) - # should have expected type - self.assertTrue('xpected Gio.FileEnumerator' in str(e), e) - # should have actual type - self.assertTrue('GIMarshallingTests.Object' in str(e), e) + # should have argument name + self.assertTrue('self' in str(e), e) + # should have expected type + self.assertTrue('xpected Gio.FileEnumerator' in str(e), e) + # should have actual type + self.assertTrue('GIMarshallingTests.Object' in str(e), e) # wrong type for first argument: GObject var = GLib.Variant('s', 'mystring') @@ -2360,16 +2355,70 @@ class TestInterfaces(unittest.TestCase): Gio.SimpleAction.activate(obj, obj) self.fail('call with wrong type argument unexpectedly succeeded') except TypeError as e: + # should have argument name + self.assertTrue('self' in str(e), e) + # should have expected type + self.assertTrue('xpected Gio.Action' in str(e), e) + # should have actual type + self.assertTrue('GIMarshallingTests.Object' in str(e), e) + + +class TestMRO(unittest.TestCase): + def test_mro(self): + # check that our own MRO calculation matches what we would expect + # from Python's own C3 calculations + class A(object): + pass + + class B(A): + pass + + class C(A): + pass + + class D(B, C): + pass + + class E(D, GIMarshallingTests.Object): + pass + + expected = (E, D, B, C, A, GIMarshallingTests.Object, + GObject.Object, GObject.Object.__base__, gi._gobject.GObject, + object) + self.assertEqual(expected, E.__mro__) + + def test_interface_collision(self): + # there was a problem with Python bailing out because of + # http://en.wikipedia.org/wiki/Diamond_problem with interfaces, + # which shouldn't really be a problem. + + class TestInterfaceImpl(GObject.GObject, GIMarshallingTests.Interface): + pass + + class TestInterfaceImpl2(GIMarshallingTests.Interface, + TestInterfaceImpl): + pass + + class TestInterfaceImpl3(TestInterfaceImpl, + GIMarshallingTests.Interface2): + pass + + def test_old_style_mixin(self): + # Note: Old style classes don't exist in Python 3 + class Mixin: + pass + + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + + # Dynamically create a new gi based class with an old + # style mixin. + type('GIWithOldStyleMixin', (GIMarshallingTests.Object, Mixin), {}) + if sys.version_info < (3, 0): - self.assertTrue('SimpleAction' in str(e), e) - self.assertTrue('Object' in str(e), e) + self.assertTrue(issubclass(warn[0].category, RuntimeWarning)) else: - # should have argument name - self.assertTrue('self' in str(e), e) - # should have expected type - self.assertTrue('xpected Gio.Action' in str(e), e) - # should have actual type - self.assertTrue('GIMarshallingTests.Object' in str(e), e) + self.assertEqual(len(warn), 0) class TestInterfaceClash(unittest.TestCase): @@ -2894,36 +2943,6 @@ class TestObjectInfo(unittest.TestCase): GObject.ObjectClass.__info__) -class TestSignatureArgs(unittest.TestCase): - def test_split_args_multi_out(self): - in_args, out_args = gi.types.split_function_info_args(GIMarshallingTests.int_out_out.__info__) - self.assertEqual(len(in_args), 0) - self.assertEqual(len(out_args), 2) - self.assertEqual(out_args[0].get_pytype_hint(), 'int') - self.assertEqual(out_args[1].get_pytype_hint(), 'int') - - def test_split_args_inout(self): - in_args, out_args = gi.types.split_function_info_args(GIMarshallingTests.long_inout_max_min.__info__) - self.assertEqual(len(in_args), 1) - self.assertEqual(len(out_args), 1) - self.assertEqual(in_args[0].get_name(), out_args[0].get_name()) - self.assertEqual(in_args[0].get_pytype_hint(), out_args[0].get_pytype_hint()) - - def test_split_args_none(self): - obj = GIMarshallingTests.Object(int=33) - in_args, out_args = gi.types.split_function_info_args(obj.none_inout.__info__) - self.assertEqual(len(in_args), 1) - self.assertEqual(len(out_args), 1) - - def test_final_signature_with_full_inout(self): - self.assertEqual(GIMarshallingTests.Object.full_inout.__doc__, - 'full_inout(object:GIMarshallingTests.Object) -> object:GIMarshallingTests.Object') - - def test_overridden_doc_is_not_clobbered(self): - self.assertEqual(GIMarshallingTests.OverridesObject.method.__doc__, - 'Overridden doc string.') - - class TestDeprecation(unittest.TestCase): def test_method(self): d = GLib.Date.new() diff --git a/tests/test_gobject.py b/tests/test_gobject.py index 64422bd..57d3822 100644 --- a/tests/test_gobject.py +++ b/tests/test_gobject.py @@ -629,7 +629,7 @@ class TestGValue(unittest.TestCase): value = GObject.Value(GObject.TYPE_FLOAT, 23.4) self.assertEqual(value.g_type, GObject.TYPE_FLOAT) self.assertRaises(TypeError, value.set_value, 'string') - self.assertRaises(ValueError, value.set_value, 1e50) + self.assertRaises(OverflowError, value.set_value, 1e50) def test_float_inf_nan(self): nan = float('nan') diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py index fdb3ccb..f9d21c2 100644 --- a/tests/test_overrides_gtk.py +++ b/tests/test_overrides_gtk.py @@ -156,73 +156,6 @@ class TestGtk(unittest.TestCase): mi = ui.get_widget("/menubær1") self.assertEqual(type(mi), Gtk.MenuBar) - def test_builder(self): - self.assertEqual(Gtk.Builder, gi.overrides.Gtk.Builder) - - class SignalTest(GObject.GObject): - __gtype_name__ = "GIOverrideSignalTest" - __gsignals__ = { - "test-signal": (GObject.SignalFlags.RUN_FIRST, - None, - []), - } - - class SignalCheck: - def __init__(self): - self.sentinel = 0 - self.after_sentinel = 0 - - def on_signal_1(self, *args): - self.sentinel += 1 - self.after_sentinel += 1 - - def on_signal_3(self, *args): - self.sentinel += 3 - - def on_signal_after(self, *args): - if self.after_sentinel == 1: - self.after_sentinel += 1 - - signal_checker = SignalCheck() - builder = Gtk.Builder() - - # add object1 to the builder - builder.add_from_string(""" -<interface> - <object class="GIOverrideSignalTest" id="object1"> - <signal name="test-signal" after="yes" handler="on_signal_after" /> - <signal name="test-signal" handler="on_signal_1" /> - </object> -</interface> -""") - - # only add object3 to the builder - builder.add_objects_from_string(""" -<interface> - <object class="GIOverrideSignalTest" id="object2"> - <signal name="test-signal" handler="on_signal_2" /> - </object> - <object class="GIOverrideSignalTest" id="object3"> - <signal name="test-signal" handler="on_signal_3" /> - </object> - <object class="GIOverrideSignalTest" id="object4"> - <signal name="test-signal" handler="on_signal_4" /> - </object> -</interface> -""", ['object3']) - - # hook up signals - builder.connect_signals(signal_checker) - - # call their notify signals and check sentinel - objects = builder.get_objects() - self.assertEqual(len(objects), 2) - for obj in objects: - obj.emit('test-signal') - - self.assertEqual(signal_checker.sentinel, 4) - self.assertEqual(signal_checker.after_sentinel, 2) - def test_window(self): # standard Window w = Gtk.Window() @@ -551,8 +484,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, '__call__')) - self.assertTrue(hasattr(widget.drag_get_data, '__call__')) + self.assertTrue(hasattr(widget, 'drag_dest_set_proxy')) + self.assertTrue(hasattr(widget, 'drag_get_data')) def test_drag_target_list(self): mixed_target_list = [Gtk.TargetEntry.new('test0', 0, 0), @@ -657,6 +590,135 @@ class TestGtk(unittest.TestCase): @unittest.skipUnless(Gtk, 'Gtk not available') +class TestBuilder(unittest.TestCase): + class SignalTest(GObject.GObject): + __gtype_name__ = "GIOverrideSignalTest" + __gsignals__ = { + "test-signal": (GObject.SignalFlags.RUN_FIRST, + None, + []), + } + + def test_extract_handler_and_args_object(self): + class Obj(): + pass + + obj = Obj() + obj.foo = lambda: None + + handler, args = Gtk.Builder._extract_handler_and_args(obj, 'foo') + self.assertEqual(handler, obj.foo) + self.assertEqual(len(args), 0) + + def test_extract_handler_and_args_dict(self): + obj = {'foo': lambda: None} + + handler, args = Gtk.Builder._extract_handler_and_args(obj, 'foo') + self.assertEqual(handler, obj['foo']) + self.assertEqual(len(args), 0) + + def test_extract_handler_and_args_with_seq(self): + obj = {'foo': (lambda: None, 1, 2)} + + handler, args = Gtk.Builder._extract_handler_and_args(obj, 'foo') + self.assertEqual(handler, obj['foo'][0]) + self.assertSequenceEqual(args, [1, 2]) + + def test_extract_handler_and_args_no_handler_error(self): + obj = dict(foo=lambda: None) + self.assertRaises(AttributeError, + Gtk.Builder._extract_handler_and_args, + obj, 'not_a_handler') + + def test_builder_with_handler_and_args(self): + builder = Gtk.Builder() + builder.add_from_string(""" + <interface> + <object class="GIOverrideSignalTest" id="object_sig_test"> + <signal name="test-signal" handler="on_signal1" /> + <signal name="test-signal" handler="on_signal2" after="yes" /> + </object> + </interface> + """) + + args_collector = [] + + def on_signal(*args): + args_collector.append(args) + + builder.connect_signals({'on_signal1': (on_signal, 1, 2), + 'on_signal2': on_signal}) + + objects = builder.get_objects() + self.assertEqual(len(objects), 1) + obj, = objects + obj.emit('test-signal') + + self.assertEqual(len(args_collector), 2) + self.assertSequenceEqual(args_collector[0], (obj, 1, 2)) + self.assertSequenceEqual(args_collector[1], (obj, )) + + def test_builder(self): + self.assertEqual(Gtk.Builder, gi.overrides.Gtk.Builder) + + class SignalCheck: + def __init__(self): + self.sentinel = 0 + self.after_sentinel = 0 + + def on_signal_1(self, *args): + self.sentinel += 1 + self.after_sentinel += 1 + + def on_signal_3(self, *args): + self.sentinel += 3 + + def on_signal_after(self, *args): + if self.after_sentinel == 1: + self.after_sentinel += 1 + + signal_checker = SignalCheck() + builder = Gtk.Builder() + + # add object1 to the builder + builder.add_from_string(""" +<interface> + <object class="GIOverrideSignalTest" id="object1"> + <signal name="test-signal" after="yes" handler="on_signal_after" /> + <signal name="test-signal" handler="on_signal_1" /> + </object> +</interface> +""") + + # only add object3 to the builder + builder.add_objects_from_string(""" +<interface> + <object class="GIOverrideSignalTest" id="object2"> + <signal name="test-signal" handler="on_signal_2" /> + </object> + <object class="GIOverrideSignalTest" id="object3"> + <signal name="test-signal" handler="on_signal_3" /> + </object> + <object class="GIOverrideSignalTest" id="object4"> + <signal name="test-signal" handler="on_signal_4" /> + </object> +</interface> +""", ['object3']) + + # hook up signals + builder.connect_signals(signal_checker) + + # call their notify signals and check sentinel + objects = builder.get_objects() + self.assertEqual(len(objects), 2) + for obj in objects: + obj.emit('test-signal') + + self.assertEqual(signal_checker.sentinel, 4) + self.assertEqual(signal_checker.after_sentinel, 2) + + +@unittest.skipUnless(Gtk, 'Gtk not available') class TestTreeModel(unittest.TestCase): def test_tree_model_sort(self): self.assertEqual(Gtk.TreeModelSort, gi.overrides.Gtk.TreeModelSort) diff --git a/tests/test_properties.py b/tests/test_properties.py index 4b128f3..ef6b867 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -69,6 +69,9 @@ class PropertyObject(GObject.GObject): type=TYPE_VARIANT, flags=PARAM_READWRITE | PARAM_CONSTRUCT, default=GLib.Variant('i', 42)) + interface = GObject.Property( + type=Gio.File, flags=PARAM_READWRITE | PARAM_CONSTRUCT) + class PropertyInheritanceObject(Regress.TestObj): # override property from the base class, with a different type @@ -133,6 +136,7 @@ class TestPropertyObject(unittest.TestCase): 'enum', 'flags', 'gtype', + 'interface', 'normal', 'strings', 'uint64', @@ -389,6 +393,17 @@ class TestPropertyObject(unittest.TestCase): obj = new(PropertyObject, variant_def=GLib.Variant('u', 5)) self.assertEqual(obj.props.variant_def.print_(True), 'uint32 5') + def test_interface(self): + obj = new(PropertyObject) + + file = Gio.File.new_for_path('/some/path') + obj.props.interface = file + self.assertEqual(obj.props.interface.get_path(), '/some/path') + self.assertEqual(obj.interface.get_path(), '/some/path') + + self.assertRaises(TypeError, setattr, obj, 'interface', 'foo') + self.assertRaises(TypeError, setattr, obj, 'interface', object()) + def test_range(self): # kiwi code def max(c): @@ -827,6 +842,7 @@ class TestProperty(unittest.TestCase): self.assertEqual(tester._type_from_python(GObject.GEnum), GObject.GEnum.__gtype__) self.assertEqual(tester._type_from_python(GObject.GFlags), GObject.GFlags.__gtype__) self.assertEqual(tester._type_from_python(GObject.GBoxed), GObject.GBoxed.__gtype__) + self.assertEqual(tester._type_from_python(GObject.GInterface), GObject.GInterface.__gtype__) for type_ in [TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR, TYPE_INT, TYPE_UINT, TYPE_BOOLEAN, TYPE_LONG, diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c index 516cb97..9b198c3 100644 --- a/tests/testhelpermodule.c +++ b/tests/testhelpermodule.c @@ -615,7 +615,7 @@ PYGLIB_MODULE_START(testhelper, "testhelper") d = PyModule_GetDict(module); - if ((m = PyImport_ImportModule("gi._gobject._gobject")) == NULL) { + if ((m = PyImport_ImportModule("gi.repository.GObject")) == NULL) { PyErr_SetString(PyExc_ImportError, "could not import gobject"); return PYGLIB_MODULE_ERROR_RETURN; |