Accepting request 661679 from GNOME:Next

Add upstream bug fix patches

OBS-URL: https://build.opensuse.org/request/show/661679
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gobject-introspection?expand=0&rev=196
This commit is contained in:
Dominique Leuenberger 2018-12-28 10:29:15 +00:00 committed by Git OBS Bridge
parent dd99ff6848
commit 8225934db7
5 changed files with 612 additions and 0 deletions

View File

@ -0,0 +1,353 @@
From 92fb04afa680bbe5089003db6f62c5e0cef25255 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= <tomasz.miasko@gmail.com>
Date: Fri, 23 Nov 2018 00:00:00 +0000
Subject: [PATCH] Define grefcount and gatomicrefcount as aliases to gint
Backport from !76, as requested in #254
---
giscanner/ast.py | 2 +
....TestReferenceCounters-atomicrefcount.page | 14 ++++++
...egress.TestReferenceCounters-refcount.page | 14 ++++++
.../Regress.TestReferenceCounters.page | 35 +++++++++++++++
....TestReferenceCounters-atomicrefcount.page | 18 ++++++++
...egress.TestReferenceCounters-refcount.page | 18 ++++++++
.../Regress.TestReferenceCounters.page | 43 +++++++++++++++++++
....TestReferenceCounters-atomicrefcount.page | 14 ++++++
...egress.TestReferenceCounters-refcount.page | 14 ++++++
.../Regress.TestReferenceCounters.page | 40 +++++++++++++++++
tests/scanner/Regress-1.0-expected.gir | 8 ++++
tests/scanner/regress.h | 8 ++++
12 files changed, 228 insertions(+)
create mode 100644 tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-atomicrefcount.page
create mode 100644 tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-refcount.page
create mode 100644 tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters.page
create mode 100644 tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-atomicrefcount.page
create mode 100644 tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-refcount.page
create mode 100644 tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters.page
create mode 100644 tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-atomicrefcount.page
create mode 100644 tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-refcount.page
create mode 100644 tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters.page
diff --git a/giscanner/ast.py b/giscanner/ast.py
index a9a6e13b..75daa459 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -322,6 +322,8 @@ type_names['gssize'] = TYPE_SSIZE
type_names['gintptr'] = TYPE_INTPTR
type_names['guintptr'] = TYPE_UINTPTR
type_names['gconstpointer'] = TYPE_ANY
+type_names['grefcount'] = TYPE_INT
+type_names['gatomicrefcount'] = TYPE_INT
# We used to support these; continue to do so
type_names['any'] = TYPE_ANY
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-atomicrefcount.page b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-atomicrefcount.page
new file mode 100644
index 00000000..6c07402d
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-atomicrefcount.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-atomicrefcount"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+ </info>
+ <title>Regress.TestReferenceCounters->atomicrefcount</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-refcount.page b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-refcount.page
new file mode 100644
index 00000000..ed4aab56
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters-refcount.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-refcount"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+ </info>
+ <title>Regress.TestReferenceCounters->refcount</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters.page b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters.page
new file mode 100644
index 00000000..8176ff9a
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.TestReferenceCounters.page
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters"
+ type="guide"
+ style="class"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="index" group="class" type="guide"/>
+ </info>
+ <title>Regress.TestReferenceCounters</title>
+
+
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-csrc"
+ groups="constructor" style="linklist">
+ <title>Constructors</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-csrc"
+ groups="method" style="linklist">
+ <title>Methods</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-csrc"
+ groups="function" style="linklist">
+ <title>Static Functions</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="field" style="linklist">
+ <title>Fields</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
+ <title>Other</title>
+ </links>
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-atomicrefcount.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-atomicrefcount.page
new file mode 100644
index 00000000..afd078e2
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-atomicrefcount.page
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-atomicrefcount"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+ <title type="link" role="topic">atomicrefcount</title>
+ </info>
+ <title>Regress.TestReferenceCounters.atomicrefcount</title>
+ <synopsis><code mime="text/x-gjs">
+TestReferenceCounters.atomicrefcount: Number(gint) (Read / Write)
+ </code></synopsis>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-refcount.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-refcount.page
new file mode 100644
index 00000000..8784e28a
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters-refcount.page
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-refcount"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+ <title type="link" role="topic">refcount</title>
+ </info>
+ <title>Regress.TestReferenceCounters.refcount</title>
+ <synopsis><code mime="text/x-gjs">
+TestReferenceCounters.refcount: Number(gint) (Read / Write)
+ </code></synopsis>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters.page
new file mode 100644
index 00000000..8f5b2d2d
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestReferenceCounters.page
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters"
+ type="guide"
+ style="class"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="index" group="class" type="guide"/>
+ </info>
+ <title>Regress.TestReferenceCounters</title>
+ <synopsis><code>
+const Regress = imports.gi.Regress;
+
+let testReferenceCounters = new Regress.TestReferenceCounters({
+ <link xref='Regress.TestReferenceCounters-refcount'>refcount</link>: value
+ <link xref='Regress.TestReferenceCounters-atomicrefcount'>atomicrefcount</link>: value
+});
+ </code></synopsis>
+
+
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-gjs"
+ groups="constructor" style="linklist">
+ <title>Constructors</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-gjs"
+ groups="method" style="linklist">
+ <title>Methods</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-gjs"
+ groups="function" style="linklist">
+ <title>Static Functions</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="field" style="linklist">
+ <title>Fields</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
+ <title>Other</title>
+ </links>
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-atomicrefcount.page b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-atomicrefcount.page
new file mode 100644
index 00000000..6c07402d
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-atomicrefcount.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-atomicrefcount"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+ </info>
+ <title>Regress.TestReferenceCounters->atomicrefcount</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-refcount.page b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-refcount.page
new file mode 100644
index 00000000..ed4aab56
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters-refcount.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters-refcount"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.TestReferenceCounters" group="field" type="guide"/>
+ </info>
+ <title>Regress.TestReferenceCounters->refcount</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters.page b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters.page
new file mode 100644
index 00000000..bc8651ab
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.TestReferenceCounters.page
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<page id="Regress.TestReferenceCounters"
+ type="guide"
+ style="class"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="index" group="class" type="guide"/>
+ </info>
+ <title>Regress.TestReferenceCounters</title>
+ <synopsis><code>
+from gi.repository import Regress
+
+test_reference_counters = Regress.TestReferenceCounters()
+ </code></synopsis>
+
+
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/python"
+ groups="constructor" style="linklist">
+ <title>Constructors</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/python"
+ groups="method" style="linklist">
+ <title>Methods</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/python"
+ groups="function" style="linklist">
+ <title>Static Functions</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="field" style="linklist">
+ <title>Fields</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
+ <title>Other</title>
+ </links>
+</page>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index f69b8514..1753233f 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -4022,6 +4022,14 @@ the introspection client langage.</doc>
<type name="gint" c:type="gint"/>
</field>
</record>
+ <record name="TestReferenceCounters" c:type="RegressTestReferenceCounters">
+ <field name="refcount" writable="1">
+ <type name="gint" c:type="grefcount"/>
+ </field>
+ <field name="atomicrefcount" writable="1">
+ <type name="gint" c:type="gatomicrefcount"/>
+ </field>
+ </record>
<enumeration name="TestReferenceEnum" c:type="RegressTestReferenceEnum">
<member name="0" value="4" c:identifier="REGRESS_TEST_REFERENCE_0">
</member>
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index f0885f2b..df5a0c25 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -4,6 +4,7 @@
#ifndef _GI_DISABLE_CAIRO
#include <cairo-gobject.h>
#endif
+#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <time.h>
@@ -1491,4 +1492,11 @@ typedef struct {
GVariant *
regress_get_variant (void);
+typedef struct _RegressTestReferenceCounters RegressTestReferenceCounters;
+
+struct _RegressTestReferenceCounters {
+ grefcount refcount;
+ gatomicrefcount atomicrefcount;
+};
+
#endif /* __GITESTTYPES_H__ */
--
2.18.1

View File

@ -0,0 +1,181 @@
From b03e687287433c0fa57910d8f8e2ffa2d2e3fdc5 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed, 26 Dec 2018 21:48:13 +0100
Subject: [PATCH] Update glib annotations (glib-2-58)
---
gir/gio-2.0.c | 24 ++++++++++++++++--------
gir/glib-2.0.c | 31 +++++++++++++++++++++++--------
gir/gobject-2.0.c | 2 +-
3 files changed, 40 insertions(+), 17 deletions(-)
diff --git a/gir/gio-2.0.c b/gir/gio-2.0.c
index ce76cdb8..766c0cd1 100644
--- a/gir/gio-2.0.c
+++ b/gir/gio-2.0.c
@@ -14916,7 +14916,7 @@
* dispatched anywhere else - not even the standard dispatch machinery
* (that API such as g_dbus_connection_signal_subscribe() and
* g_dbus_connection_send_message_with_reply() relies on) will see the
- * message. Similary, if a filter consumes an outgoing message, the
+ * message. Similarly, if a filter consumes an outgoing message, the
* message will not be sent to the other peer.
*
* If @user_data_free_func is non-%NULL, it will be called (in the
@@ -16798,7 +16798,7 @@
/**
* g_dbus_message_bytes_needed:
- * @blob: (array length=blob_len) (element-type guint8): A blob represent a binary D-Bus message.
+ * @blob: (array length=blob_len) (element-type guint8): A blob representing a binary D-Bus message.
* @blob_len: The length of @blob (must be at least 16).
* @error: Return location for error or %NULL.
*
@@ -16904,7 +16904,10 @@
*
* Gets a header field on @message.
*
- * Returns: A #GVariant with the value if the header was found, %NULL
+ * The caller is responsible for checking the type of the returned #GVariant
+ * matches what is expected.
+ *
+ * Returns: (transfer none) (nullable): A #GVariant with the value if the header was found, %NULL
* otherwise. Do not free, it is owned by @message.
* Since: 2.26
*/
@@ -17080,6 +17083,9 @@
* order that the message was in can be retrieved using
* g_dbus_message_get_byte_order().
*
+ * If the @blob cannot be parsed, contains invalid fields, or contains invalid
+ * headers, %G_IO_ERROR_INVALID_ARGUMENT will be returned.
+ *
* Returns: A new #GDBusMessage or %NULL if @error is set. Free with
* g_object_unref().
* Since: 2.26
@@ -24907,8 +24913,8 @@
* native, the returned string is the result of g_file_get_uri()
* (such as `sftp://path/to/my%20icon.png`).
*
- * - If @icon is a #GThemedIcon with exactly one name, the encoding is
- * simply the name (such as `network-server`).
+ * - If @icon is a #GThemedIcon with exactly one name and no fallbacks,
+ * the encoding is simply the name (such as `network-server`).
*
* Returns: (nullable): An allocated NUL-terminated UTF8 string or
* %NULL if @icon can't be serialized. Use g_free() to free.
@@ -38394,8 +38400,10 @@
* the beginning of the communication, you do not need to call this
* function explicitly unless you want clearer error reporting.
* However, you may call g_tls_connection_handshake() later on to
- * rehandshake, if TLS 1.2 or older is in use. With TLS 1.3, this will
- * instead perform a rekey.
+ * rehandshake, if TLS 1.2 or older is in use. With TLS 1.3, the
+ * behavior is undefined but guaranteed to be reasonable and
+ * nondestructive, so most older code should be expected to continue to
+ * work without changes.
*
* #GTlsConnection::accept_certificate may be emitted during the
* handshake.
@@ -40809,7 +40817,7 @@
* also listen for the "removed" signal on the returned object
* and give up its reference when handling that signal
*
- * Similary, if implementing g_volume_monitor_adopt_orphan_mount(),
+ * Similarly, if implementing g_volume_monitor_adopt_orphan_mount(),
* the implementor must take a reference to @mount and return it in
* its g_volume_get_mount() implemented. Also, the implementor must
* listen for the "unmounted" signal on @mount and give up its
diff --git a/gir/glib-2.0.c b/gir/glib-2.0.c
index 66ab9a05..46149833 100644
--- a/gir/glib-2.0.c
+++ b/gir/glib-2.0.c
@@ -2108,7 +2108,9 @@
*
* GLib is attempting to unify around the use of 64bit integers to
* represent microsecond-precision time. As such, this type will be
- * removed from a future version of GLib.
+ * removed from a future version of GLib. A consequence of using `glong` for
+ * `tv_sec` is that on 32-bit systems `GTimeVal` is subject to the year 2038
+ * problem.
*/
@@ -6708,7 +6710,10 @@
*
* The above definition is recursive to arbitrary depth. "aaaaai" and
* "(ui(nq((y)))s)" are both valid type strings, as is
- * "a(aa(ui)(qna{ya(yd)}))".
+ * "a(aa(ui)(qna{ya(yd)}))". In order to not hit memory limits, #GVariant
+ * imposes a limit on recursion depth of 65 nested containers. This is the
+ * limit in the D-Bus specification (64) plus one to allow a #GDBusMessage to
+ * be nested in a top-level tuple.
*
* The meaning of each of the characters is as follows:
* - `b`: the type string of %G_VARIANT_TYPE_BOOLEAN; a boolean value.
@@ -11729,8 +11734,8 @@
* @stamp: (out) (optional): return location for the last registration time, or %NULL
* @error: return location for a #GError, or %NULL
*
- * Gets the registration informations of @app_name for the bookmark for
- * @uri. See g_bookmark_file_set_app_info() for more informations about
+ * Gets the registration information of @app_name for the bookmark for
+ * @uri. See g_bookmark_file_set_app_info() for more information about
* the returned data.
*
* The string returned in @app_exec must be freed.
@@ -33031,10 +33036,12 @@
* variation of ISO 8601 format is required.
*
* If @time_ represents a date which is too large to fit into a `struct tm`,
- * %NULL will be returned. This is platform dependent, but it is safe to assume
- * years up to 3000 are supported. The return value of g_time_val_to_iso8601()
- * has been nullable since GLib 2.54; before then, GLib would crash under the
- * same conditions.
+ * %NULL will be returned. This is platform dependent. Note also that since
+ * `GTimeVal` stores the number of seconds as a `glong`, on 32-bit systems it
+ * is subject to the year 2038 problem.
+ *
+ * The return value of g_time_val_to_iso8601() has been nullable since GLib
+ * 2.54; before then, GLib would crash under the same conditions.
*
* Returns: (nullable): a newly allocated string containing an ISO 8601 date,
* or %NULL if @time_ was too large
@@ -36438,6 +36445,11 @@
* The returned value is never floating. You should free it with
* g_variant_unref() when you're done with it.
*
+ * 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
+ * nesting up to at least 64 levels.
+ *
* This function is O(1).
*
* Returns: (transfer full): the child at the specified index
@@ -36923,6 +36935,9 @@
* being trusted. If the value was already marked as being trusted then
* this function will immediately return %TRUE.
*
+ * There may be implementation specific restrictions on deeply nested values.
+ * GVariant is guaranteed to handle nesting up to at least 64 levels.
+ *
* Returns: %TRUE if @value is in normal form
* Since: 2.24
*/
diff --git a/gir/gobject-2.0.c b/gir/gobject-2.0.c
index 1a4f3bcb..89091e1b 100644
--- a/gir/gobject-2.0.c
+++ b/gir/gobject-2.0.c
@@ -6509,7 +6509,7 @@
*
* Get the contents of a variant #GValue.
*
- * Returns: (nullable): variant contents of @value (may be %NULL)
+ * Returns: (transfer none) (nullable): variant contents of @value (may be %NULL)
* Since: 2.26
*/
--
2.18.1

View File

@ -0,0 +1,61 @@
From 74c506e7c0b04c9aac242afc08cd6731bea5992a Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed, 19 Dec 2018 22:17:16 +0100
Subject: [PATCH] docwriter: Support markdown 3.x. Fixes #250
---
giscanner/docwriter.py | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py
index a29ba374..dae2ca9e 100644
--- a/giscanner/docwriter.py
+++ b/giscanner/docwriter.py
@@ -34,7 +34,6 @@ import tempfile
from xml.sax import saxutils
from mako.lookup import TemplateLookup
import markdown
-from markdown.extensions.headerid import HeaderIdExtension
from . import ast, xmlwriter
from .utils import to_underscores
@@ -66,6 +65,18 @@ language_mimes = {
}
+def get_headerid_ext():
+ try:
+ from markdown.extensions.headerid import HeaderIdExtension
+ except ImportError:
+ # markdown 3.x
+ from markdown.extensions.toc import TocExtension
+ return TocExtension(toc_depth=0)
+ else:
+ # markdown 2.x
+ return HeaderIdExtension(forceid=False)
+
+
def make_page_id(node, recursive=False):
if isinstance(node, ast.Namespace):
if recursive:
@@ -1175,7 +1186,7 @@ class DevDocsFormatterGjs(DocFormatterGjs):
'markdown.extensions.fenced_code',
'markdown.extensions.nl2br',
'markdown.extensions.attr_list',
- HeaderIdExtension(forceid=False)
+ get_headerid_ext(),
])
def format_function_name(self, func):
@@ -1263,7 +1274,7 @@ class DevDocsFormatterGjs(DocFormatterGjs):
'markdown.extensions.fenced_code',
'markdown.extensions.nl2br',
'markdown.extensions.attr_list',
- HeaderIdExtension(forceid=False)
+ get_headerid_ext(),
])
def format_in_parameters(self, node):
--
2.18.1

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Thu Dec 27 22:57:34 UTC 2018 - bjorn.lie@gmail.com
- Add upstream bug fix patches from stable branch:
+ gi-docwriter-Support-markdown-3.x.patch: docwriter: Support
markdown 3.x.
+ gi-Define-grefcount-and-gatomicrefcount-as-aliases.patch:
Define grefcount and gatomicrefcount as aliases to gint.
+ gi-Update-glib-annotations.patch: Update glib annotations
(glib-2-58).
-------------------------------------------------------------------
Sun Dec 9 12:49:03 UTC 2018 - bjorn.lie@gmail.com

View File

@ -32,6 +32,12 @@ Source2: gobjectintrospection.attr
Source3: gobject-introspection-typelib.template
Source98: baselibs.conf
Source99: %{name}-rpmlintrc
# PATCH-FIX-UPSTREAM gi-docwriter-Support-markdown-3.x.patch -- docwriter: Support markdown 3.x
Patch0: gi-docwriter-Support-markdown-3.x.patch
# PATCH-FIX-UPSTREAM gi-Define-grefcount-and-gatomicrefcount-as-aliases.patch -- Define grefcount and gatomicrefcount as aliases to gint
Patch1: gi-Define-grefcount-and-gatomicrefcount-as-aliases.patch
# PATCH-FIX-UPSTREAM gi-Update-glib-annotations.patch -- Update glib annotations (glib-2-58)
Patch2: gi-Update-glib-annotations.patch
BuildRequires: bison
BuildRequires: fdupes