diff options
38 files changed, 692 insertions, 120 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 16a8f3bb..0cb71530 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -79,7 +79,7 @@ fedora-x86_64-python3.5: msys2-mingw32-meson: stage: build tags: - - win32 + - win32-ps variables: MSYSTEM: "MINGW32" CHERE_INVOKING: "yes" @@ -88,19 +88,19 @@ msys2-mingw32-meson: - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2-meson.sh" artifacts: when: on_failure - name: "gi-_%CI_COMMIT_REF_NAME%" + name: "gi-_${env:CI_COMMIT_REF_NAME}" paths: - _build/meson-logs vs2017-x64-meson: stage: build tags: - - win32 + - win32-ps script: - .gitlab-ci/test-msvc.bat artifacts: when: on_failure - name: "gi-_%CI_COMMIT_REF_NAME%" + name: "gi-_${env:CI_COMMIT_REF_NAME}" paths: - _build/meson-logs diff --git a/.gitlab-ci/test-msvc.bat b/.gitlab-ci/test-msvc.bat index a2ee44b2..549d4fd1 100644 --- a/.gitlab-ci/test-msvc.bat +++ b/.gitlab-ci/test-msvc.bat @@ -1,5 +1,5 @@ @echo on -call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 +call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64 @echo on py -3 -c "import urllib.request, sys; urllib.request.urlretrieve(*sys.argv[1:])" "https://github.com/lexxmark/winflexbison/releases/download/v2.5.14/win_flex_bison-2.5.14.zip" win_flex_bison.zip @@ -1,3 +1,10 @@ +1.64.1 - 2020-04-05 +------------------- + +* Replace calls to deprecated xml.etree.cElementTree removed in Python 3.9 :mr:`202` (:user:`Stephen Gallagher <sgallagher>`) +* gimarshallingtests: Use g_assert_cmpfloat_with_epsilon. Fixes tests on some architectures :mr:`200` (:user:`Iain Lane <iainl>`) + + 1.64.0 - 2020-03-07 ------------------- diff --git a/docs/g-ir-compiler.1 b/docs/g-ir-compiler.1 index 48dc5ceb..f3eda03c 100644 --- a/docs/g-ir-compiler.1 +++ b/docs/g-ir-compiler.1 @@ -72,7 +72,7 @@ Show program\(aqs version number and exit Report bugs at \fI\%https://gitlab.gnome.org/GNOME/gobject\-introspection/issues\fP .SH HOMEPAGE AND CONTACT .sp -\fI\%http://live.gnome.org/GObjectIntrospection\fP +\fI\%https://gi.readthedocs.io/\fP .SH AUTHORS .sp Mattias Clasen diff --git a/docs/g-ir-generate.1 b/docs/g-ir-generate.1 index 038d171f..f05a295a 100644 --- a/docs/g-ir-generate.1 +++ b/docs/g-ir-generate.1 @@ -58,7 +58,7 @@ Show program\(aqs version number and exit Report bugs at \fI\%https://gitlab.gnome.org/GNOME/gobject\-introspection/issues\fP .SH HOMEPAGE AND CONTACT .sp -\fI\%http://live.gnome.org/GObjectIntrospection\fP +\fI\%https://gi.readthedocs.io/\fP .SH AUTHORS .sp Mattias Clasen diff --git a/docs/g-ir-scanner.1 b/docs/g-ir-scanner.1 index 528bed5c..d25f321b 100644 --- a/docs/g-ir-scanner.1 +++ b/docs/g-ir-scanner.1 @@ -177,7 +177,7 @@ generating introspection data in a cross-compilation environment. Report bugs at \fI\%https://gitlab.gnome.org/GNOME/gobject\-introspection/issues\fP .SH HOMEPAGE AND CONTACT .sp -\fI\%http://live.gnome.org/GObjectIntrospection\fP +\fI\%https://gi.readthedocs.io/\fP .SH AUTHORS .sp Johan Dahlin diff --git a/docs/reference/gi-struct-hierarchy.xml b/docs/reference/gi-struct-hierarchy.xml index 685f85aa..7d40e053 100644 --- a/docs/reference/gi-struct-hierarchy.xml +++ b/docs/reference/gi-struct-hierarchy.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" - "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'"> <!ENTITY version SYSTEM "version.xml"> ]> diff --git a/docs/website/tools/g-ir-compiler.rst b/docs/website/tools/g-ir-compiler.rst index 5c17a7ce..28ca44aa 100644 --- a/docs/website/tools/g-ir-compiler.rst +++ b/docs/website/tools/g-ir-compiler.rst @@ -62,7 +62,7 @@ Report bugs at https://gitlab.gnome.org/GNOME/gobject-introspection/issues HOMEPAGE and CONTACT ==================== -http://live.gnome.org/GObjectIntrospection +https://gi.readthedocs.io/ AUTHORS diff --git a/docs/website/tools/g-ir-generate.rst b/docs/website/tools/g-ir-generate.rst index 931ee449..0b0c8fe0 100644 --- a/docs/website/tools/g-ir-generate.rst +++ b/docs/website/tools/g-ir-generate.rst @@ -48,7 +48,7 @@ Report bugs at https://gitlab.gnome.org/GNOME/gobject-introspection/issues HOMEPAGE and CONTACT ==================== -http://live.gnome.org/GObjectIntrospection +https://gi.readthedocs.io/ AUTHORS diff --git a/docs/website/tools/g-ir-scanner.rst b/docs/website/tools/g-ir-scanner.rst index fc6abe3e..e8df7457 100644 --- a/docs/website/tools/g-ir-scanner.rst +++ b/docs/website/tools/g-ir-scanner.rst @@ -166,7 +166,7 @@ Report bugs at https://gitlab.gnome.org/GNOME/gobject-introspection/issues HOMEPAGE and CONTACT ==================== -http://live.gnome.org/GObjectIntrospection +https://gi.readthedocs.io/ AUTHORS diff --git a/docs/website/users.rst b/docs/website/users.rst index 6d651092..c2faf51b 100644 --- a/docs/website/users.rst +++ b/docs/website/users.rst @@ -14,7 +14,7 @@ Bindings based on GObject-Introspection * `JGIR <https://wiki.gnome.org/Projects/JGIR>`__ - Java/JVM bindings (compile time, using typelib) * `GJS <https://wiki.gnome.org/Projects/Gjs>`__ - Javascript (spidermonkey) bindings (runtime) * `Seed <https://wiki.gnome.org/Projects/Seed>`__ - Javascript (JSCore, WebKit JS engine) bindings (runtime) -* `sbank <http://live.gnome.org/sbank>`__ - Scheme binding for gobject-introspection (runtime) +* `sbank <https://wiki.gnome.org/sbank>`__ - Scheme binding for gobject-introspection (runtime) * `GObjectIntrospection/GObjectConsume <https://wiki.gnome.org/Projects/GObjectIntrospection/GObjectConsume>`__ - Qt bindings (compile time) * `GirFFI <http://github.com/mvz/ruby-gir-ffi>`__ - Ruby bindings (runtime) * `Ruby-GNOME <https://github.com/ruby-gnome/ruby-gnome>`__ - Ruby bindings (runtime) diff --git a/gir/gio-2.0.c b/gir/gio-2.0.c index 2d4e7bac..64812d38 100644 --- a/gir/gio-2.0.c +++ b/gir/gio-2.0.c @@ -1649,7 +1649,7 @@ /** - * GDtlsConnection:advertised-protocols: + * GDtlsConnection:advertised-protocols: (nullable) * * The list of application-layer protocols that the connection * advertises that it is willing to speak. See @@ -1680,7 +1680,7 @@ /** - * GDtlsConnection:database: + * GDtlsConnection:database: (nullable) * * The certificate database to use when verifying this TLS connection. * If no certificate database is set, then the default database will be @@ -1691,7 +1691,7 @@ /** - * GDtlsConnection:interaction: + * GDtlsConnection:interaction: (nullable) * * A #GTlsInteraction object to be used when the connection or certificate * database need to interact with the user. This will be used to prompt the @@ -1712,7 +1712,7 @@ /** - * GDtlsConnection:peer-certificate: + * GDtlsConnection:peer-certificate: (nullable) * * The connection's peer's certificate, after the TLS handshake has * completed and the certificate has been accepted. Note in @@ -3791,7 +3791,7 @@ /** - * GTlsConnection:advertised-protocols: + * GTlsConnection:advertised-protocols: (nullable) * * The list of application-layer protocols that the connection * advertises that it is willing to speak. See @@ -3825,7 +3825,7 @@ /** - * GTlsConnection:database: + * GTlsConnection:database: (nullable) * * The certificate database to use when verifying this TLS connection. * If no certificate database is set, then the default database will be @@ -3836,7 +3836,7 @@ /** - * GTlsConnection:interaction: + * GTlsConnection:interaction: (nullable) * * A #GTlsInteraction object to be used when the connection or certificate * database need to interact with the user. This will be used to prompt the @@ -3857,7 +3857,7 @@ /** - * GTlsConnection:peer-certificate: + * GTlsConnection:peer-certificate: (nullable) * * The connection's peer's certificate, after the TLS handshake has * completed and the certificate has been accepted. Note in @@ -4736,7 +4736,7 @@ * arguments are passed through platform communication to the already * running program. The already running instance of the program is * called the "primary instance"; for non-unique applications this is - * the always the current instance. On Linux, the D-Bus session bus + * always the current instance. On Linux, the D-Bus session bus * is used for communication. * * The use of #GApplication differs from some other commonly-used @@ -6919,6 +6919,13 @@ * - Run a garbage collection cycle * - Try and compress fragmented allocations * - Exit on idle if the process has no reason to stay around + * - Call [`malloc_trim(3)`](man:malloc_trim) to return cached heap pages to + * the kernel (if supported by your libc) + * + * Note that some actions may not always improve system performance, and so + * should be profiled for your application. `malloc_trim()`, for example, may + * make future heap allocations slower (due to releasing cached heap pages back + * to the kernel). * * See #GMemoryMonitorWarningLevel for details on the various warning levels. * @@ -20396,7 +20403,7 @@ * Gets @conn's certificate, as set by * g_dtls_connection_set_certificate(). * - * Returns: (transfer none): @conn's certificate, or %NULL + * Returns: (transfer none) (nullable): @conn's certificate, or %NULL * Since: 2.48 */ @@ -20408,7 +20415,7 @@ * Gets the certificate database that @conn uses to verify * peer certificates. See g_dtls_connection_set_database(). * - * Returns: (transfer none): the certificate database that @conn uses or %NULL + * Returns: (transfer none) (nullable): the certificate database that @conn uses or %NULL * Since: 2.48 */ @@ -20421,7 +20428,7 @@ * for things like prompting the user for passwords. If %NULL is returned, then * no user interaction will occur for this connection. * - * Returns: (transfer none): The interaction object. + * Returns: (transfer none) (nullable): The interaction object. * Since: 2.48 */ @@ -20451,7 +20458,7 @@ * (It is not set during the emission of * #GDtlsConnection::accept-certificate.) * - * Returns: (transfer none): @conn's peer's certificate, or %NULL + * Returns: (transfer none) (nullable): @conn's peer's certificate, or %NULL * Since: 2.48 */ @@ -20617,7 +20624,7 @@ /** * g_dtls_connection_set_database: * @conn: a #GDtlsConnection - * @database: a #GTlsDatabase + * @database: (nullable): a #GTlsDatabase * * Sets the certificate database that is used to verify peer certificates. * This is set to the default database by default. See @@ -25372,7 +25379,7 @@ /** * g_icon_deserialize: - * @value: a #GVariant created with g_icon_serialize() + * @value: (transfer none): a #GVariant created with g_icon_serialize() * * Deserializes a #GIcon previously serialized using g_icon_serialize(). * @@ -25431,7 +25438,7 @@ * makes sense to transfer the #GVariant between processes on the same machine, * (as opposed to over the network), and within the same file system namespace. * - * Returns: (transfer full): a #GVariant, or %NULL when serialization fails. + * Returns: (transfer full): a #GVariant, or %NULL when serialization fails. The #GVariant will not be floating. * Since: 2.38 */ @@ -25747,8 +25754,8 @@ * * Parses @string as an IP address and creates a new #GInetAddress. * - * Returns: a new #GInetAddress corresponding to @string, or %NULL if - * @string could not be parsed. + * Returns: (nullable) (transfer full): a new #GInetAddress corresponding + * to @string, or %NULL if @string could not be parsed. * Free the returned object with g_object_unref(). * Since: 2.22 */ @@ -25861,8 +25868,8 @@ * If @address is an IPv6 address, it can also contain a scope ID * (separated from the address by a `%`). * - * Returns: a new #GInetSocketAddress, or %NULL if @address cannot be - * parsed. + * Returns: (nullable) (transfer full): a new #GInetSocketAddress, + * or %NULL if @address cannot be parsed. * Since: 2.40 */ @@ -39321,7 +39328,7 @@ * Gets @conn's certificate, as set by * g_tls_connection_set_certificate(). * - * Returns: (transfer none): @conn's certificate, or %NULL + * Returns: (transfer none) (nullable): @conn's certificate, or %NULL * Since: 2.28 */ @@ -39333,7 +39340,7 @@ * Gets the certificate database that @conn uses to verify * peer certificates. See g_tls_connection_set_database(). * - * Returns: (transfer none): the certificate database that @conn uses or %NULL + * Returns: (transfer none) (nullable): the certificate database that @conn uses or %NULL * Since: 2.30 */ @@ -39346,7 +39353,7 @@ * for things like prompting the user for passwords. If %NULL is returned, then * no user interaction will occur for this connection. * - * Returns: (transfer none): The interaction object. + * Returns: (transfer none) (nullable): The interaction object. * Since: 2.30 */ @@ -39376,7 +39383,7 @@ * (It is not set during the emission of * #GTlsConnection::accept-certificate.) * - * Returns: (transfer none): @conn's peer's certificate, or %NULL + * Returns: (transfer none) (nullable): @conn's peer's certificate, or %NULL * Since: 2.28 */ @@ -39560,7 +39567,7 @@ /** * g_tls_connection_set_database: * @conn: a #GTlsConnection - * @database: a #GTlsDatabase + * @database: (nullable): a #GTlsDatabase * * Sets the certificate database that is used to verify peer certificates. * This is set to the default database by default. See diff --git a/gir/glib-2.0.c b/gir/glib-2.0.c index 76876983..931caca0 100644 --- a/gir/glib-2.0.c +++ b/gir/glib-2.0.c @@ -4889,14 +4889,15 @@ * To create a new array use g_array_new(). * * To add elements to an array, use g_array_append_val(), - * g_array_append_vals(), g_array_prepend_val(), and - * g_array_prepend_vals(). + * g_array_append_vals(), g_array_prepend_val(), g_array_prepend_vals(), + * g_array_insert_val() and g_array_insert_vals(). * - * To access an element of an array, use g_array_index(). + * To access an element of an array (to read it or write it), + * use g_array_index(). * * To set the size of an array, use g_array_set_size(). * - * To free an array, use g_array_free(). + * To free an array, use g_array_unref() or g_array_free(). * * Here is an example that stores integers in a #GArray: * |[<!-- language="C" --> @@ -8633,9 +8634,23 @@ * The implementations of the Unicode functions in GLib are based * on the Unicode Character Data tables, which are available from * [www.unicode.org](http://www.unicode.org/). - * GLib 2.8 supports Unicode 4.0, GLib 2.10 supports Unicode 4.1, - * GLib 2.12 supports Unicode 5.0, GLib 2.16.3 supports Unicode 5.1, - * GLib 2.30 supports Unicode 6.0. + * + * * Unicode 4.0 was added in GLib 2.8 + * * Unicode 4.1 was added in GLib 2.10 + * * Unicode 5.0 was added in GLib 2.12 + * * Unicode 5.1 was added in GLib 2.16.3 + * * Unicode 6.0 was added in GLib 2.30 + * * Unicode 6.1 was added in GLib 2.32 + * * Unicode 6.2 was added in GLib 2.36 + * * Unicode 6.3 was added in GLib 2.40 + * * Unicode 7.0 was added in GLib 2.42 + * * Unicode 8.0 was added in GLib 2.48 + * * Unicode 9.0 was added in GLib 2.50.1 + * * Unicode 10.0 was added in GLib 2.54 + * * Unicode 11.10 was added in GLib 2.58 + * * Unicode 12.0 was added in GLib 2.62 + * * Unicode 12.1 was added in GLib 2.62 + * * Unicode 13.0 was added in GLib 2.66 */ @@ -8935,14 +8950,29 @@ * @i: the index of the element to return * * Returns the element of a #GArray at the given index. The return - * value is cast to the given type. + * value is cast to the given type. This is the main way to read or write an + * element in a #GArray. * - * This example gets a pointer to an element in a #GArray: + * Writing an element is typically done by reference, as in the following + * example. This example gets a pointer to an element in a #GArray, and then + * writes to a field in it: * |[<!-- language="C" --> * EDayViewEvent *event; * // This gets a pointer to the 4th element in the array of * // EDayViewEvent structs. * event = &g_array_index (events, EDayViewEvent, 3); + * event->start_time = g_get_current_time (); + * ]| + * + * This example reads from and writes to an array of integers: + * |[<!-- language="C" --> + * g_autoptr(GArray) int_array = g_array_new (FALSE, FALSE, sizeof (guint)); + * for (guint i = 0; i < 10; i++) + * g_array_append_val (int_array, i); + * + * guint *my_int = &g_array_index (int_array, guint, 1); + * g_print ("Int at index 1 is %u; decrementing it\n", *my_int); + * *my_int = *my_int - 1; * ]| * * Returns: the element of the #GArray at the index given by @i @@ -8979,6 +9009,10 @@ * will be initialised to zero if the array was configured to clear elements; * otherwise their values will be undefined. * + * If @index_ is less than the array’s current length, new entries will be + * inserted into the array, and the existing entries above @index_ will be moved + * upwards. + * * @data may be %NULL if (and only if) @len is zero. If @len is zero, this * function is a no-op. * @@ -36997,6 +37031,12 @@ * The returned value is never floating. You should free it with * g_variant_unref() when you're done with it. * + * Note that values borrowed from the returned child are not guaranteed to + * still be valid after the child is freed even if you still hold a reference + * to @value, if @value has not been serialised at the time this function is + * called. To avoid this, you can serialize @value by calling + * g_variant_get_data() and optionally ignoring the return value. + * * There may be implementation specific restrictions on deeply nested values, * which would result in the unit tuple being returned as the child value, * instead of further nested children. #GVariant is guaranteed to handle diff --git a/gir/gobject-2.0.c b/gir/gobject-2.0.c index 9ea50c91..f773584b 100644 --- a/gir/gobject-2.0.c +++ b/gir/gobject-2.0.c @@ -419,8 +419,8 @@ * * ## Parameter names # {#canonical-parameter-names} * - * A property name consists of segments consisting of ASCII letters and - * digits, separated by either the `-` or `_` character. The first + * A property name consists of one or more segments consisting of ASCII letters + * and digits, separated by either the `-` or `_` character. The first * character of a property name must be a letter. These are the same rules as * for signal naming (see g_signal_new()). * @@ -3796,6 +3796,22 @@ /** + * g_param_spec_is_valid_name: + * @name: the canonical name of the property + * + * Validate a property name for a #GParamSpec. This can be useful for + * dynamically-generated properties which need to be validated at run-time + * before actually trying to create them. + * + * See [canonical parameter names][canonical-parameter-names] for details of + * the rules for valid names. + * + * Returns: %TRUE if @name is a valid property name, %FALSE otherwise. + * Since: 2.66 + */ + + +/** * g_param_spec_long: * @name: canonical name of the property specified * @nick: nick name for the property specified @@ -4719,6 +4735,22 @@ /** + * g_signal_is_valid_name: + * @name: the canonical name of the signal + * + * Validate a signal name. This can be useful for dynamically-generated signals + * which need to be validated at run-time before actually trying to create them. + * + * See [canonical parameter names][canonical-parameter-names] for details of + * the rules for valid names. The rules for signal names are the same as those + * for property names. + * + * Returns: %TRUE if @name is a valid signal name, %FALSE otherwise. + * Since: 2.66 + */ + + +/** * g_signal_list_ids: * @itype: Instance or interface type. * @n_ids: Location to store the number of signal ids for @itype. diff --git a/girepository/cmph/meson.build b/girepository/cmph/meson.build index 5bc41a33..2a0cef7e 100644 --- a/girepository/cmph/meson.build +++ b/girepository/cmph/meson.build @@ -26,6 +26,7 @@ cmph_sources = [ cmph_deps = [ glib_dep, + gobject_dep, cc.find_library('m', required: false), ] @@ -67,6 +68,7 @@ cmph_test = executable('cmph-bdz-test', '../cmph-bdz-test.c', dependencies: [ cmph_dep, glib_dep, + gobject_dep, ], c_args: custom_c_args, ) diff --git a/girepository/giobjectinfo.c b/girepository/giobjectinfo.c index efb9ad76..3f3423cc 100644 --- a/girepository/giobjectinfo.c +++ b/girepository/giobjectinfo.c @@ -89,7 +89,7 @@ g_object_info_get_field_offset (GIObjectInfo *info, * * Obtain the parent of the object type. * - * Returns: (transfer full): the #GIObjectInfo. Free the struct by calling + * Returns: (transfer full) (nullable): the #GIObjectInfo. Free the struct by calling * g_base_info_unref() when done. */ GIObjectInfo * diff --git a/girepository/girepository.c b/girepository/girepository.c index b7948d61..7d034859 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -1144,7 +1144,7 @@ g_irepository_get_version (GIRepository *repository, * Note: The namespace must have already been loaded using a function * such as g_irepository_require() before calling this function. * - * Returns: Comma-separated list of paths to shared libraries, + * Returns: (nullable): Comma-separated list of paths to shared libraries, * or %NULL if none are associated */ const gchar * diff --git a/girepository/gitypeinfo.c b/girepository/gitypeinfo.c index 1434b2f3..e90f9463 100644 --- a/girepository/gitypeinfo.c +++ b/girepository/gitypeinfo.c @@ -347,3 +347,173 @@ g_type_info_get_array_type (GITypeInfo *info) return -1; } + +/** + * g_type_info_get_storage_type: + * @info: a #GITypeInfo + * + * Obtain the type tag corresponding to the underlying storage type in C for + * the type. + * See #GITypeTag for a list of type tags. + * + * Returns: the type tag + * + * Since: 1.66 + */ +GITypeTag +g_type_info_get_storage_type (GITypeInfo *info) +{ + GITypeTag type_tag = g_type_info_get_tag (info); + + if (type_tag == GI_TYPE_TAG_INTERFACE) + { + GIBaseInfo *interface = g_type_info_get_interface (info); + GIInfoType info_type = g_base_info_get_type (interface); + if (info_type == GI_INFO_TYPE_ENUM || info_type == GI_INFO_TYPE_FLAGS) + type_tag = g_enum_info_get_storage_type (interface); + g_base_info_unref (interface); + } + + return type_tag; +} + +/** + * g_type_info_argument_from_hash_pointer: + * @info: a #GITypeInfo + * @hash_pointer: A pointer, such as a #GHashTable data pointer + * @arg: A #GIArgument to fill in + * + * GLib data structures, such as #GList, #GSList, and #GHashTable, all store + * data pointers. + * In the case where the list or hash table is storing single types rather than + * structs, these data pointers may have values stuffed into them via macros + * such as %GPOINTER_TO_INT. + * + * Use this function to ensure that all values are correctly extracted from + * stuffed pointers, regardless of the machine's architecture or endianness. + * + * This function fills in the appropriate field of @arg with the value extracted + * from @hash_pointer, depending on the storage type of @info. + * + * Since: 1.66 + */ +void +g_type_info_argument_from_hash_pointer (GITypeInfo *info, + gpointer hash_pointer, + GIArgument *arg) +{ + GITypeTag type_tag = g_type_info_get_storage_type (info); + + switch (type_tag) + { + case GI_TYPE_TAG_BOOLEAN: + arg->v_boolean = !!GPOINTER_TO_INT (hash_pointer); + break; + case GI_TYPE_TAG_INT8: + arg->v_int8 = (gint8)GPOINTER_TO_INT (hash_pointer); + break; + case GI_TYPE_TAG_UINT8: + arg->v_uint8 = (guint8)GPOINTER_TO_UINT (hash_pointer); + break; + case GI_TYPE_TAG_INT16: + arg->v_int16 = (gint16)GPOINTER_TO_INT (hash_pointer); + break; + case GI_TYPE_TAG_UINT16: + arg->v_uint16 = (guint16)GPOINTER_TO_UINT (hash_pointer); + break; + case GI_TYPE_TAG_INT32: + arg->v_int32 = (gint32)GPOINTER_TO_INT (hash_pointer); + break; + case GI_TYPE_TAG_UINT32: + case GI_TYPE_TAG_UNICHAR: + arg->v_uint32 = (guint32)GPOINTER_TO_UINT (hash_pointer); + break; + case GI_TYPE_TAG_GTYPE: + arg->v_size = GPOINTER_TO_SIZE (hash_pointer); + break; + case GI_TYPE_TAG_UTF8: + case GI_TYPE_TAG_FILENAME: + case GI_TYPE_TAG_INTERFACE: + case GI_TYPE_TAG_ARRAY: + case GI_TYPE_TAG_GLIST: + case GI_TYPE_TAG_GSLIST: + case GI_TYPE_TAG_GHASH: + case GI_TYPE_TAG_ERROR: + arg->v_pointer = hash_pointer; + break; + case GI_TYPE_TAG_INT64: + case GI_TYPE_TAG_UINT64: + case GI_TYPE_TAG_FLOAT: + case GI_TYPE_TAG_DOUBLE: + default: + g_critical ("Unsupported type for pointer-stuffing: %s", + g_type_tag_to_string (type_tag)); + arg->v_pointer = hash_pointer; + } +} + +/** + * g_type_info_hash_pointer_from_argument: + * @info: a #GITypeInfo + * @arg: A #GIArgument with the value to stuff into a pointer + * + * GLib data structures, such as #GList, #GSList, and #GHashTable, all store + * data pointers. + * In the case where the list or hash table is storing single types rather than + * structs, these data pointers may have values stuffed into them via macros + * such as %GPOINTER_TO_INT. + * + * Use this function to ensure that all values are correctly stuffed into + * pointers, regardless of the machine's architecture or endianness. + * + * This function returns a pointer stuffed with the appropriate field of @arg, + * depending on the storage type of @info. + * + * Returns: A stuffed pointer, that can be stored in a #GHashTable, for example + * + * Since: 1.66 + */ +gpointer +g_type_info_hash_pointer_from_argument (GITypeInfo *info, + GIArgument *arg) +{ + GITypeTag type_tag = g_type_info_get_storage_type (info); + + switch (type_tag) + { + case GI_TYPE_TAG_BOOLEAN: + return GINT_TO_POINTER (arg->v_boolean); + case GI_TYPE_TAG_INT8: + return GINT_TO_POINTER (arg->v_int8); + case GI_TYPE_TAG_UINT8: + return GUINT_TO_POINTER (arg->v_uint8); + case GI_TYPE_TAG_INT16: + return GINT_TO_POINTER (arg->v_int16); + case GI_TYPE_TAG_UINT16: + return GUINT_TO_POINTER (arg->v_uint16); + case GI_TYPE_TAG_INT32: + return GINT_TO_POINTER (arg->v_int32); + case GI_TYPE_TAG_UINT32: + case GI_TYPE_TAG_UNICHAR: + return GUINT_TO_POINTER (arg->v_uint32); + case GI_TYPE_TAG_GTYPE: + return GSIZE_TO_POINTER (arg->v_size); + case GI_TYPE_TAG_UTF8: + case GI_TYPE_TAG_FILENAME: + case GI_TYPE_TAG_INTERFACE: + case GI_TYPE_TAG_ARRAY: + case GI_TYPE_TAG_GLIST: + case GI_TYPE_TAG_GSLIST: + case GI_TYPE_TAG_GHASH: + case GI_TYPE_TAG_ERROR: + return arg->v_pointer; + case GI_TYPE_TAG_INT64: + case GI_TYPE_TAG_UINT64: + case GI_TYPE_TAG_FLOAT: + case GI_TYPE_TAG_DOUBLE: + default: + g_critical ("Unsupported type for pointer-stuffing: %s", + g_type_tag_to_string (type_tag)); + return arg->v_pointer; + } +} diff --git a/girepository/gitypeinfo.h b/girepository/gitypeinfo.h index 4d5679c9..fd7d5be6 100644 --- a/girepository/gitypeinfo.h +++ b/girepository/gitypeinfo.h @@ -80,6 +80,18 @@ gboolean g_type_info_is_zero_terminated (GITypeInfo *info); GI_AVAILABLE_IN_ALL GIArrayType g_type_info_get_array_type (GITypeInfo *info); +GI_AVAILABLE_IN_1_66 +GITypeTag g_type_info_get_storage_type (GITypeInfo *info); + +GI_AVAILABLE_IN_1_66 +void g_type_info_argument_from_hash_pointer (GITypeInfo *info, + gpointer hash_pointer, + GIArgument *arg); + +GI_AVAILABLE_IN_1_66 +gpointer g_type_info_hash_pointer_from_argument (GITypeInfo *info, + GIArgument *arg); + G_END_DECLS diff --git a/girepository/giversionmacros.h b/girepository/giversionmacros.h index c32e5bb8..a941ee2d 100644 --- a/girepository/giversionmacros.h +++ b/girepository/giversionmacros.h @@ -159,4 +159,10 @@ # define GI_AVAILABLE_IN_1_60 _GI_EXTERN #endif +#if defined(GLIB_VERSION_2_66) && GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_66 +# define GI_AVAILABLE_IN_1_66 GLIB_UNAVAILABLE(2, 66) +#else +# define GI_AVAILABLE_IN_1_66 _GI_EXTERN +#endif + #endif /* __GIVERSIONMACROS_H__ */ diff --git a/girepository/meson.build b/girepository/meson.build index 204659fe..6cd8fd30 100644 --- a/girepository/meson.build +++ b/girepository/meson.build @@ -17,12 +17,13 @@ girepo_gthash_lib = static_library('girepository-gthash', cmph_dep, glib_dep, gmodule_dep, + gobject_dep, ], ) girepo_gthash_dep = declare_dependency( link_with: girepo_gthash_lib, - dependencies: [glib_dep, gmodule_dep], + dependencies: [glib_dep, gmodule_dep, gobject_dep], include_directories: include_directories('.'), ) diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index 9ab629b3..63212963 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -440,6 +440,27 @@ SIGNAL_RE = re.compile( ''', re.UNICODE | re.VERBOSE) +# Pattern matching action identifiers. +ACTION_RE = re.compile( + r''' + ^ # start + \s* # 0 or more whitespace characters + (?P<class_name>[\w]+) # class name + \s* # 0 or more whitespace characters + \|{1} # 1 required vertical bar + \s* # 0 or more whitespace characters + (?P<action_name>[\w-]+\.[\w-]+) # action name + \s* # 0 or more whitespace characters + (?P<delimiter>:?) # delimiter + \s* # 0 or more whitespace characters + (?P<fields>.*?) # annotations + description + \s* # 0 or more whitespace characters + :? # invalid delimiter + \s* # 0 or more whitespace characters + $ # end + ''', + re.UNICODE | re.VERBOSE) + # Pattern matching parameters. PARAMETER_RE = re.compile( r''' @@ -545,7 +566,7 @@ class GtkDocAnnotatable(object): self.annotations = GtkDocAnnotations() def __repr__(self): - return "<GtkDocAnnotatable '%s' %r>" % (self.annotations, ) + return "<GtkDocAnnotatable '%s'>" % (self.annotations, ) def validate(self): ''' @@ -1338,13 +1359,22 @@ class GtkDocCommentBlockParser(object): identifier_fields = result.group('fields') identifier_fields_start = result.start('fields') else: - result = SYMBOL_RE.match(line) + result = ACTION_RE.match(line) if result: - identifier_name = '%s' % (result.group('symbol_name'), ) - identifier_delimiter = result.group('delimiter') - identifier_fields = result.group('fields') - identifier_fields_start = result.start('fields') + identifier_name = 'ACTION:%s:%s' % (result.group('class_name'), + result.group('action_name')) + identifier_delimiter = None + identifier_fields = None + identifier_fields_start = None + else: + result = SYMBOL_RE.match(line) + + if result: + identifier_name = '%s' % (result.group('symbol_name'), ) + identifier_delimiter = result.group('delimiter') + identifier_fields = result.group('fields') + identifier_fields_start = result.start('fields') if result: in_part = PART_IDENTIFIER @@ -2117,7 +2147,7 @@ class GtkDocCommentBlockWriter(object): lines = [] # Identifier part - if block.name.startswith('SECTION'): + if block.name.startswith('SECTION') or block.name.startswith('ACTION'): lines.append(block.name) else: if block.annotations: diff --git a/giscanner/dumper.py b/giscanner/dumper.py index 0c10a780..e4b6ea03 100644 --- a/giscanner/dumper.py +++ b/giscanner/dumper.py @@ -126,7 +126,7 @@ class DumpCompiler(object): if len(self._get_type_functions) > 0: for func in self._get_type_functions: f.write("extern GType " + func + "(void);\n") - f.write("GType (*GI_GET_TYPE_FUNCS_[])(void) = {\n") + f.write("G_MODULE_EXPORT GType (*GI_GET_TYPE_FUNCS_[])(void) = {\n") first = True for func in self._get_type_functions: if first: @@ -138,7 +138,7 @@ class DumpCompiler(object): if len(self._error_quark_functions) > 0: for func in self._error_quark_functions: f.write("extern GQuark " + func + "(void);\n") - f.write("GQuark (*GI_ERROR_QUARK_FUNCS_[])(void) = {\n") + f.write("G_MODULE_EXPORT GQuark (*GI_ERROR_QUARK_FUNCS_[])(void) = {\n") first = True for func in self._error_quark_functions: if first: diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py index 1730fee5..e7ccf575 100644 --- a/giscanner/gdumpparser.py +++ b/giscanner/gdumpparser.py @@ -22,7 +22,7 @@ import os import sys import tempfile import subprocess -from xml.etree.cElementTree import parse +from xml.etree.ElementTree import parse from . import ast from . import message diff --git a/giscanner/girparser.py b/giscanner/girparser.py index 0a6c687b..35206a41 100644 --- a/giscanner/girparser.py +++ b/giscanner/girparser.py @@ -21,7 +21,7 @@ import os from collections import OrderedDict -from xml.etree.cElementTree import parse +from xml.etree.ElementTree import parse from . import ast from .girwriter import COMPATIBLE_GIR_VERSION diff --git a/giscanner/utils.py b/giscanner/utils.py index e8c246dd..e3396c6e 100644 --- a/giscanner/utils.py +++ b/giscanner/utils.py @@ -255,7 +255,7 @@ def get_system_data_dirs(): If any changes are made to that function they'll need to be copied here. ''' xdg_data_dirs = [x for x in os.environ.get('XDG_DATA_DIRS', '').split(os.pathsep)] - if not xdg_data_dirs and os.name != 'nt': + if not any(xdg_data_dirs) and os.name != 'nt': xdg_data_dirs.append('/usr/local/share') xdg_data_dirs.append('/usr/share') diff --git a/gobject-introspection.doap b/gobject-introspection.doap index 0da06245..6e59acc5 100644 --- a/gobject-introspection.doap +++ b/gobject-introspection.doap @@ -13,7 +13,7 @@ <description xml:lang="en">GObject introspection provides tools and libraries to help manage its common metadata format for representing GObject-based C APIs, designed for bindings, documentation tools and API verification.</description> - <homepage rdf:resource="http://live.gnome.org/GObjectIntrospection" /> + <homepage rdf:resource="https://gi.readthedocs.io/" /> <license rdf:resource="http://usefulinc.com/doap/licenses/lgpl" /> <bug-database rdf:resource="https://gitlab.gnome.org/GNOME/gobject-introspection/issues/" /> <mailing-list rdf:resource="mailto:gtk-devel-list@gnome.org" /> diff --git a/meson.build b/meson.build index 3d22dd55..6f3ba8c8 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('gobject-introspection', 'c', - version: '1.64.1', + version: '1.65.1', meson_version: '>= 0.50.1', default_options: [ 'warning_level=1', @@ -9,6 +9,8 @@ project('gobject-introspection', 'c', host_system = host_machine.system() gi_versions = meson.project_version().split('.') +build_root = meson.current_build_dir() +source_root = meson.current_source_dir() configinc = include_directories('.') @@ -152,6 +154,9 @@ endif libffi_dep = dependency('libffi', fallback : ['libffi', 'ffi_dep']) +# python headers +cc.check_header('Python.h', dependencies: [python.dependency()], required: true) + # cairo cairo_option = get_option('cairo') if cc.get_id() == 'msvc' @@ -264,3 +269,21 @@ configure_file( configuration: pkgconfig_conf, install_dir: join_paths(get_option('libdir'), 'pkgconfig'), ) + +# Dependency object used by Meson's GNOME module. This dependency variable must +# be named girepo_dep for backward compatibility with projects that where already +# using that name as fallback: dependency('gobject-introspection-1.0', +# fallback : ['gobject-introspection', 'girepo_dep']) +# FIXME: meson.override_dependency() and declare_dependency()'s variable arguments +# are new in Meson 0.54.0, older versions of Meson won't be able to use g-i as +# subproject anyway +if meson.version().version_compare('>=0.54.0') + girepo_dep = declare_dependency( + sources: typelibs, + dependencies: girepo_dep, + variables: { + 'girdir': meson.current_build_dir() / 'gir', + }, + ) + meson.override_dependency('gobject-introspection-1.0', girepo_dep) +endif diff --git a/meson_options.txt b/meson_options.txt index 20ccc3b9..dff9be8e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -26,8 +26,8 @@ option('gir_dir_prefix', type: 'string', description: 'Intermediate prefix for gir installation under ${prefix}' ) -option('gi_cross_use_host_gi', type: 'boolean', value : false, - description: 'Use gobject introspection tools installed in the host system (useful when cross-compiling)' +option('gi_cross_use_prebuilt_gi', type: 'boolean', value : false, + description: 'Use gobject introspection tools installed in the build system (useful when cross-compiling)' ) option('gi_cross_binary_wrapper', type: 'string', diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 92868016..53c17818 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -3167,13 +3167,13 @@ gi_marshalling_tests_ghashtable_double_in (GHashTable *hash_table) double *value; value = g_hash_table_lookup (hash_table, "-1"); - g_assert_cmpfloat (*value, ==, -0.1); + g_assert_cmpfloat_with_epsilon (*value, -0.1, 0.01); value = g_hash_table_lookup (hash_table, "0"); g_assert_cmpfloat (*value, ==, 0.0); value = g_hash_table_lookup (hash_table, "1"); - g_assert_cmpfloat (*value, ==, 0.1); + g_assert_cmpfloat_with_epsilon (*value, 0.1, 0.01); value = g_hash_table_lookup (hash_table, "2"); - g_assert_cmpfloat (*value, ==, 0.2); + g_assert_cmpfloat_with_epsilon (*value, 0.2, 0.01); } /** @@ -3188,13 +3188,13 @@ gi_marshalling_tests_ghashtable_float_in (GHashTable *hash_table) float *value; value = g_hash_table_lookup (hash_table, "-1"); - g_assert_cmpfloat (*value, ==, -0.1f); + g_assert_cmpfloat_with_epsilon (*value, -0.1f, 0.01f); value = g_hash_table_lookup (hash_table, "0"); g_assert_cmpfloat (*value, ==, 0.0f); value = g_hash_table_lookup (hash_table, "1"); - g_assert_cmpfloat (*value, ==, 0.1f); + g_assert_cmpfloat_with_epsilon (*value, 0.1f, 0.01f); value = g_hash_table_lookup (hash_table, "2"); - g_assert_cmpfloat (*value, ==, 0.2f); + g_assert_cmpfloat_with_epsilon (*value, 0.2f, 0.01f); } /** @@ -4584,6 +4584,33 @@ gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObject *s } /** + * gi_marshalling_tests_object_vfunc_one_inout_parameter: + * @a: (inout): + */ +void +gi_marshalling_tests_object_vfunc_one_inout_parameter (GIMarshallingTestsObject *self, gfloat *a) +{ + /* make sure that local variables don't get smashed */ + gulong local = 0x12345678; + GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_one_inout_parameter (self, a); + g_assert_cmpint (local, ==, 0x12345678); +} + +/** + * gi_marshalling_tests_object_vfunc_multiple_inout_parameters: + * @a: (inout): + * @b: (inout): + */ +void +gi_marshalling_tests_object_vfunc_multiple_inout_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b) +{ + /* make sure that local variables don't get smashed */ + gulong local = 0x12345678; + GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_multiple_inout_parameters (self, a, b); + g_assert_cmpint (local, ==, 0x12345678); +} + +/** * gi_marshalling_tests_object_vfunc_multiple_out_parameters: * @a: (out): * @b: (out): @@ -4652,6 +4679,37 @@ glong } /** + * gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter: + * @a: (inout): + */ +glong gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter (GIMarshallingTestsObject *self, glong *a) +{ + /* make sure that local variables don't get smashed */ + gulong return_value; + gulong local = 0x12345678; + return_value = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_one_inout_parameter (self, a); + g_assert_cmpint (local, ==, 0x12345678); + return return_value; +} + +/** + * gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters: + * @a: (inout): + * @b: (inout): + */ +glong + gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters + (GIMarshallingTestsObject *self, glong *a, glong *b) +{ + gulong return_value; + gulong local = 0x12345678; + return_value = + GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_return_value_and_multiple_inout_parameters (self, a, b); + g_assert_cmpint (local, ==, 0x12345678); + return return_value; +} + +/** * gi_marshalling_tests_callback_owned_boxed: * @callback: (scope call) (closure callback_data): * @callback_data: (allow-none): diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index d5357ec9..747a075d 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -1410,6 +1410,19 @@ struct _GIMarshallingTestsObjectClass void (* vfunc_multiple_out_parameters) (GIMarshallingTestsObject *self, gfloat *a, gfloat *b); /** + * GIMarshallingTestsObjectClass::vfunc_one_inout_parameter: + * @a: (inout): + */ + void (* vfunc_one_inout_parameter) (GIMarshallingTestsObject *self, gfloat *a); + + /** + * GIMarshallingTestsObjectClass::vfunc_multiple_inout_parameters: + * @a: (inout): + * @b: (inout): + */ + void (* vfunc_multiple_inout_parameters) (GIMarshallingTestsObject *self, gfloat *a, gfloat *b); + + /** * GIMarshallingTestsObjectClass::vfunc_caller_allocated_out_parameter: * @a: (out): */ @@ -1435,6 +1448,19 @@ struct _GIMarshallingTestsObjectClass glong (* vfunc_return_value_and_multiple_out_parameters) (GIMarshallingTestsObject *self, glong *a, glong *b); /** + * GIMarshallingTestsObjectClass::vfunc_return_value_and_one_inout_parameter: + * @a: (inout): + */ + glong (* vfunc_return_value_and_one_inout_parameter) (GIMarshallingTestsObject *self, glong *a); + + /** + * GIMarshallingTestsObjectClass::vfunc_return_value_and_multiple_inout_parameters: + * @a: (inout): + * @b: (inout): + */ + glong (* vfunc_return_value_and_multiple_inout_parameters) (GIMarshallingTestsObject *self, glong *a, glong *b); + + /** * GIMarshallingTestsObjectClass::vfunc_meth_with_err: * @x: * @error: A #GError @@ -1561,6 +1587,12 @@ _GI_TEST_EXTERN void gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b); _GI_TEST_EXTERN +void gi_marshalling_tests_object_vfunc_one_inout_parameter (GIMarshallingTestsObject *self, gfloat *a); + +_GI_TEST_EXTERN +void gi_marshalling_tests_object_vfunc_multiple_inout_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b); + +_GI_TEST_EXTERN void gi_marshalling_tests_object_vfunc_caller_allocated_out_parameter (GIMarshallingTestsObject *self, GValue *a); _GI_TEST_EXTERN @@ -1573,6 +1605,12 @@ _GI_TEST_EXTERN glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMarshallingTestsObject *self, glong *a, glong *b); _GI_TEST_EXTERN +glong gi_marshalling_tests_object_vfunc_return_value_and_one_inout_parameter (GIMarshallingTestsObject *self, glong *a); + +_GI_TEST_EXTERN +glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_inout_parameters (GIMarshallingTestsObject *self, glong *a, glong *b); + +_GI_TEST_EXTERN gboolean gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *object, gint x, GError **error); diff --git a/tests/meson.build b/tests/meson.build index f4c57ed7..b240749e 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -115,8 +115,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--warn-all', '--warn-error', '--namespace=Everything', @@ -141,8 +141,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--warn-all', '--warn-error', '--namespace=GIMarshallingTests', @@ -163,7 +163,7 @@ if glib_dep.type_name() == 'pkgconfig' output: '@BASENAME@.typelib', depends: [gobject_gir, ], command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@', - '--includedir', join_paths(meson.build_root(), 'gir'), + '--includedir', join_paths(build_root, 'gir'), '--includedir', meson.current_build_dir() ], ) diff --git a/tests/repository/meson.build b/tests/repository/meson.build index 497ab106..17445381 100644 --- a/tests/repository/meson.build +++ b/tests/repository/meson.build @@ -10,17 +10,17 @@ if glib_dep.type_name() == 'pkgconfig' repository_test_env = environment() repository_test_env.prepend( 'GI_TYPELIB_PATH', - join_paths(meson.build_root(), 'gir'), - join_paths(meson.build_root(), 'tests'), - join_paths(meson.build_root(), 'tests', 'scanner'), + join_paths(build_root, 'gir'), + join_paths(build_root, 'tests'), + join_paths(build_root, 'tests', 'scanner'), ) repository_test_env.prepend( 'LD_LIBRARY_PATH', - join_paths(meson.build_root(), 'tests', 'scanner'), + join_paths(build_root, 'tests', 'scanner'), ) if host_system == 'windows' repository_test_env.prepend( - 'PATH', join_paths(meson.build_root(), 'tests', 'scanner')) + 'PATH', join_paths(build_root, 'tests', 'scanner')) endif custom_c_args = cc.get_supported_arguments([ diff --git a/tests/scanner/annotationparser/test_patterns.py b/tests/scanner/annotationparser/test_patterns.py index 131d6282..68db9870 100644 --- a/tests/scanner/annotationparser/test_patterns.py +++ b/tests/scanner/annotationparser/test_patterns.py @@ -33,7 +33,7 @@ import unittest from giscanner.annotationparser import (COMMENT_BLOCK_START_RE, COMMENT_BLOCK_END_RE, COMMENT_ASTERISK_RE, INDENTATION_RE, EMPTY_LINE_RE, - SECTION_RE, SYMBOL_RE, PROPERTY_RE, + SECTION_RE, SYMBOL_RE, PROPERTY_RE, ACTION_RE, SIGNAL_RE, PARAMETER_RE, TAG_RE, TAG_VALUE_VERSION_RE, TAG_VALUE_STABILITY_RE) @@ -663,6 +663,157 @@ identifier_signal_tests = [ 'delimiter': ':', 'fields': '(type GLib.List(GLib.List(utf8))) (transfer full)'})] +identifier_action_tests = [ + (ACTION_RE, 'GtkWidget|group.action (skip)', + {'class_name': 'GtkWidget', + 'action_name': 'group.action', + 'delimiter': '', + 'fields': '(skip)'}), + (ACTION_RE, 'GtkWidget|group.action', + {'class_name': 'GtkWidget', + 'action_name': 'group.action', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, ' GtkWidget |group.action', + {'class_name': 'GtkWidget', + 'action_name': 'group.action', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, 'GtkWidget| group.action ', + {'class_name': 'GtkWidget', + 'action_name': 'group.action', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, ' GtkWidget | group.action ', + {'class_name': 'GtkWidget', + 'action_name': 'group.action', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, 'GtkWidget|group.action:', + {'class_name': 'GtkWidget', + 'action_name': 'group.action', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, 'GtkWidget|group.action: ', + {'class_name': 'GtkWidget', + 'action_name': 'group.action', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, ' GtkWidget|group.action:', + {'class_name': 'GtkWidget', + 'action_name': 'group.action', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, 'Something|group.action:', + {'class_name': 'Something', + 'action_name': 'group.action', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, 'Something|group.action: ', + {'class_name': 'Something', + 'action_name': 'group.action', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, ' Something|group.action:', + {'class_name': 'Something', + 'action_name': 'group.action', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, 'Weird-thing|name:', + None), + (ACTION_RE, 'really-weird_thing|name:', + None), + (ACTION_RE, 'GWin32InputStream|group.action:', + {'class_name': 'GWin32InputStream', + 'action_name': 'group.action', + 'delimiter': ':', + 'fields': ''}), + # properties: action name that contains a dash + (ACTION_RE, 'GtkWidget|group.double-buffered (skip)', + {'class_name': 'GtkWidget', + 'action_name': 'group.double-buffered', + 'delimiter': '', + 'fields': '(skip)'}), + (ACTION_RE, 'GtkWidget|group.double-buffered', + {'class_name': 'GtkWidget', + 'action_name': 'group.double-buffered', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, ' GtkWidget |group.double-buffered', + {'class_name': 'GtkWidget', + 'action_name': 'group.double-buffered', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, 'GtkWidget| group.double-buffered ', + {'class_name': 'GtkWidget', + 'action_name': 'group.double-buffered', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, ' GtkWidget | group.double-buffered ', + {'class_name': 'GtkWidget', + 'action_name': 'group.double-buffered', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, 'GtkWidget|group.double-buffered:', + {'class_name': 'GtkWidget', + 'action_name': 'group.double-buffered', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, 'GtkWidget|group.double-buffered: ', + {'class_name': 'GtkWidget', + 'action_name': 'group.double-buffered', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, ' GtkWidget|group.double-buffered:', + {'class_name': 'GtkWidget', + 'action_name': 'group.double-buffered', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, 'Something|group.double-buffered:', + {'class_name': 'Something', + 'action_name': 'group.double-buffered', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, 'Something|group.double-buffered: ', + {'class_name': 'Something', + 'action_name': 'group.double-buffered', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, ' Something|group.double-buffered:', + {'class_name': 'Something', + 'action_name': 'group.double-buffered', + 'delimiter': ':', + 'fields': ''}), + (ACTION_RE, 'Weird-thing|double-buffered:', + None), + (ACTION_RE, 'really-weird_thing|double-buffered:', + None), + (ACTION_RE, ' GMemoryOutputStream|group.realloc-function: (skip)', + {'class_name': 'GMemoryOutputStream', + 'action_name': 'group.realloc-function', + 'delimiter': ':', + 'fields': '(skip)'}), + (ACTION_RE, 'Something|group-double.double-buffered', + {'class_name': 'Something', + 'action_name': 'group-double.double-buffered', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, 'Something| group-double.double-buffered', + {'class_name': 'Something', + 'action_name': 'group-double.double-buffered', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, 'Something |group-double.double-buffered', + {'class_name': 'Something', + 'action_name': 'group-double.double-buffered', + 'delimiter': '', + 'fields': ''}), + (ACTION_RE, 'Something | group-double.double-buffered', + {'class_name': 'Something', + 'action_name': 'group-double.double-buffered', + 'delimiter': '', + 'fields': ''})] + parameter_tests = [ (PARAMETER_RE, '@Short_description: Base class for all widgets ', {'parameter_name': 'Short_description', @@ -908,6 +1059,7 @@ def create_test_cases(): ('TestIdentifierSymbol', identifier_symbol_tests), ('TestIdentifierProperty', identifier_property_tests), ('TestIdentifierSignal', identifier_signal_tests), + ('TestIdentifierAction', identifier_action_tests), ('TestParameter', parameter_tests), ('TestTag', tag_tests), ('TestTagValueVersion', tag_value_version_tests), diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build index 50ca5a2b..fa7f7eca 100644 --- a/tests/scanner/meson.build +++ b/tests/scanner/meson.build @@ -106,7 +106,7 @@ python_path = run_command(python, ['-c', 'import sys; sys.stdout.write(sys.execu gircompiler_command = [ gircompiler, '-o', '@OUTPUT@', '@INPUT@', - '--includedir', join_paths(meson.build_root(), 'gir'), + '--includedir', join_paths(build_root, 'gir'), '--includedir', meson.current_build_dir(), ] @@ -122,8 +122,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--warn-all', '--warn-error', '--namespace=Typedefs', @@ -162,8 +162,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--warn-all', '--warn-error', '--namespace=Bar', @@ -173,7 +173,7 @@ if glib_dep.type_name() == 'pkgconfig' '--library=barapp-1.0', '--accept-unprefixed', '-L', meson.current_build_dir(), - '-L', join_paths(meson.build_root(), 'girepository'), + '-L', join_paths(build_root, 'girepository'), '-I', meson.current_source_dir(), '-I', join_paths(meson.current_source_dir(), '..'), extra_giscanner_args, @@ -201,8 +201,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--warn-all', '--warn-error', '--namespace=SLetter', @@ -239,8 +239,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--namespace=WarnLib', '--nsversion=1.0', '--include=Gio-2.0', @@ -275,8 +275,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--warn-all', '--warn-error', '--namespace=Utility', @@ -313,8 +313,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--warn-all', '--warn-error', '--namespace=GtkFrob', @@ -352,8 +352,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--namespace=GetType', '--nsversion=1.0', '--identifier-prefix=GetType', @@ -483,8 +483,8 @@ if glib_dep.type_name() == 'pkgconfig' '--output=@OUTPUT@', '--no-libtool', '--reparse-validate', - '--add-include-path', join_paths(meson.source_root(), 'gir'), - '--add-include-path', join_paths(meson.build_root(), 'gir'), + '--add-include-path', join_paths(source_root, 'gir'), + '--add-include-path', join_paths(build_root, 'gir'), '--add-include-path', meson.current_build_dir(), '--namespace=Regress', '--nsversion=1.0', @@ -542,7 +542,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig' output: 'Regress-1.0-' + language, command: [ python, girdoctool, - '--add-include-path=' + join_paths(meson.build_root(), 'gir'), + '--add-include-path=' + join_paths(build_root, 'gir'), '--add-include-path=' + meson.current_build_dir(), '--language', language, '@INPUT@', '-o', '@OUTPUT@'], @@ -570,7 +570,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig' output: 'Regress-1.0-sections.txt', command: [ python, girdoctool, - '--add-include-path=' + join_paths(meson.build_root(), 'gir'), + '--add-include-path=' + join_paths(build_root, 'gir'), '--add-include-path=' + meson.current_build_dir(), '--write-sections-file', '@INPUT@', '-o', '@OUTPUT@'], diff --git a/tests/warn/meson.build b/tests/warn/meson.build index 1f144e70..9641787f 100644 --- a/tests/warn/meson.build +++ b/tests/warn/meson.build @@ -21,12 +21,12 @@ warn_tests = [ ] warn_test_env = environment() -warn_test_env.set('UNINSTALLED_INTROSPECTION_SRCDIR', meson.source_root()) -warn_test_env.set('TOP_BUILDDIR', meson.build_root()) +warn_test_env.set('UNINSTALLED_INTROSPECTION_SRCDIR', source_root) +warn_test_env.set('TOP_BUILDDIR', build_root) warn_test_env.set( 'PYTHONPATH', - meson.build_root(), - join_paths(meson.build_root(), 'giscanner')) + build_root, + join_paths(build_root, 'giscanner')) # FIXME: Glib as a subproject (used on Windows mostly). if glib_dep.type_name() == 'pkgconfig' diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in index c4a10a28..75bf759c 100755 --- a/tools/g-ir-tool-template.in +++ b/tools/g-ir-tool-template.in @@ -53,14 +53,9 @@ if not os.path.isdir(os.path.join(datadir, 'gir-1.0')): builtins.__dict__['DATADIR'] = datadir -# Respect gir_dir_prefix for meson and autotools +# Respect gir_dir_prefix girdir = '' -# for meson -if '@gir_dir_prefix@' and not '@gir_dir_prefix@'.startswith('@'): - girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@')) -# for autotools -elif '@GIR_DIR@' and not '@GIR_DIR@'.startswith('@'): - girdir = os.path.dirname(os.path.abspath('@GIR_DIR@')) +girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@')) builtins.__dict__['GIRDIR'] = [girdir] # Again, relative paths first so that the installation prefix is relocatable diff --git a/tools/meson.build b/tools/meson.build index 50641c19..f272c955 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -22,7 +22,6 @@ foreach tool : tools tools_conf.set('datarootdir', datadir_abs) tools_conf.set('gir_dir_prefix', gir_dir_prefix) tools_conf.set('PYTHON_CMD', python_cmd) - tools_conf.set('GIR_DIR', girdir) tools_conf.set('TOOL_MODULE', tool[1]) tools_conf.set('TOOL_FUNCTION', tool[2]) @@ -34,7 +33,7 @@ foreach tool : tools ) tool_output += tool_bin # Provide tools for others when we're a subproject and they use the Meson GNOME module - if not get_option('gi_cross_use_host_gi') + if not get_option('gi_cross_use_prebuilt_gi') meson.override_find_program(tool[0], tool_bin) endif endforeach @@ -76,7 +75,7 @@ girinspect = executable('g-ir-inspect', 'g-ir-inspect.c', c_args: custom_c_args, ) -if not get_option('gi_cross_use_host_gi') +if not get_option('gi_cross_use_prebuilt_gi') meson.override_find_program('g-ir-compiler', gircompiler) meson.override_find_program('g-ir-generate', girgenerate) meson.override_find_program('g-ir-inspect', girinspect) |