From 5747b871a56c3037b0ed1afe643fe66a2f61cecd8004539dbe9b0ba3f11e03cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Lie?= Date: Fri, 17 Dec 2021 21:39:11 +0000 Subject: [PATCH] Accepting request 940788 from GNOME:Next - Add 114.patch: gir: Do not qualify type names that are already qualified. - Specify python-Markdown version to at least 3.2.0, because permalink_class options in TOC used by gi-docgen was introduced on 3.2.0: https://github.com/Python-Markdown/markdown/commit/1f3ec538a2acf25607253fc7c7a992950463931d - Update to version 2021.8: + Allow `id` fragments to link across namespace boundaries + Support links to have custom text + Decrease the max font size + Improve output for properties and signals + Save last search in the history + Don't crash on unlabelled array elements + Move type functions near constructors + Switch to Solarized for syntax highlighting + Use the C type for callback types in search results + Generate proper cross-reference links + Parse and use new gobject-introspection property attributes + Properly identify (type, gpointer) types + List the interface implementations in a namespace + List the class descendants in a namespace - Update to version 2021.7: + Add a "check" sub-command + Allow defining multiple content directories + Detect gtk-doc code blocks for JavaScript + Multiple changes to the basic template + Add in-page content navigation + Filter hidden data from indices + Allow defining hidden symbols matching a regular expression + Handle (attribute element-type) annotation for GListModel + Fix class method linking + Fix links to callback type arguments + Fix argument listing in class methods + Don't grab the 's' key when the sidebar is hidden + Index the extra content files for search + Fix gtk-doc sigil handling in code blocks + Re-instate gtk-doc `()` function detection - Switch to building only default flavour of python3. - Initial package, version 2021.2 OBS-URL: https://build.opensuse.org/request/show/940788 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/python-gi-docgen?expand=0&rev=7 --- 114.patch | 122 +++++++++++++++++++++++++++++++++++++++ gi-docgen-2021.7.tar.gz | 3 - gi-docgen-2021.8.tar.gz | 3 + python-gi-docgen.changes | 25 ++++++++ python-gi-docgen.spec | 7 ++- 5 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 114.patch delete mode 100644 gi-docgen-2021.7.tar.gz create mode 100644 gi-docgen-2021.8.tar.gz diff --git a/114.patch b/114.patch new file mode 100644 index 0000000..183578c --- /dev/null +++ b/114.patch @@ -0,0 +1,122 @@ +From 72f3c5dbe27aabb5f7a376afda23f3dfc3c2e212 Mon Sep 17 00:00:00 2001 +From: Emmanuele Bassi +Date: Thu, 28 Oct 2021 19:17:06 +0100 +Subject: [PATCH] gir: Do not qualify type names that are already qualified + +Otherwise we're going to duplicate the namespace of a type, and then +splitting the namespace from the type name won't work any more. + +We already do this for class ancestors, but we failed to do this for +interface requirements and class implementations. + +Fixes: #111 +--- + gidocgen/gdgenerate.py | 1 + + gidocgen/gir/ast.py | 48 +++++++++++++++++++++++++++--------------- + gidocgen/gir/parser.py | 2 +- + 3 files changed, 33 insertions(+), 18 deletions(-) + +diff --git a/gidocgen/gdgenerate.py b/gidocgen/gdgenerate.py +index 6c84777..c705777 100644 +--- a/gidocgen/gdgenerate.py ++++ b/gidocgen/gdgenerate.py +@@ -1153,6 +1153,7 @@ class TemplateInterface: + self.requires_ctype = requires.ctype + + self.requires_fqtn = f"{self.requires_namespace}.{self.requires_name}" ++ log.debug(f"Preqrequisite for {self.fqtn}: {self.requires_fqtn}") + + self.symbol_prefix = f"{namespace.symbol_prefix[0]}_{interface.symbol_prefix}" + self.type_cname = interface.base_ctype +diff --git a/gidocgen/gir/ast.py b/gidocgen/gir/ast.py +index 650b4cc..8a7294a 100644 +--- a/gidocgen/gir/ast.py ++++ b/gidocgen/gir/ast.py +@@ -970,13 +970,14 @@ class Repository: + + def resolve_interface_requires(self) -> None: + def find_prerequisite_type(includes, ns, name): +- for repo in includes.values(): +- if repo.namespace.name != ns: +- continue +- prereq = repo.namespace.find_prerequisite_type(name) +- if prereq is not None: +- return Type(name=f"{repo.namespace.name}.{prereq.name}", ctype=prereq.ctype) +- return None ++ repository = includes.get(ns) ++ if repository is None: ++ return None ++ prereq = repository.namespace.find_prerequisite_type(name) ++ # If the prerequisite type is unqualified, then we qualify it here ++ if '.' not in prereq.name: ++ prereq.name = f"{repository.namespace.name}.{prereq.name}" ++ return prereq + + ifaces = self.namespace.get_interfaces() + for iface in ifaces: +@@ -993,12 +994,24 @@ class Repository: + prerequisite = self.namespace.find_prerequisite_type(iface.prerequisite.name) + if prerequisite is not None: + if prerequisite.ctype is None: +- t = self._lookup_type(prerequisite.name) +- prerequisite.ctype = t.ctype ++ if '.' not in prerequisite.name: ++ name = f"{self.namespace.name}.{prerequisite.name}" ++ else: ++ name = prerequisite.name ++ t = self._lookup_type(name) ++ if t is not None: ++ prerequisite.ctype = t.ctype ++ else: ++ # This is kind of a kludge, but apparently we can get into ++ # class definitions missing a c:type; if that happens, we ++ # take the identifier prefix of the namespace and append the ++ # class name, because that's the inverse of how g-ir-scanner ++ # determines the class name ++ prerequisite.ctype = f"{self.namespace.identifier_prefix[0]}{prerequisite.name}" + iface.prerequisite = prerequisite + log.debug(f"Prerequisite type for interface {iface}: {iface.prerequisite}") + +- def resolve_class_type(self) -> None: ++ def resolve_class_ctype(self) -> None: + classes = self.namespace.get_classes() + for cls in classes: + if cls.ctype is None: +@@ -1020,13 +1033,14 @@ class Repository: + + def resolve_class_implements(self) -> None: + def find_interface_type(includes, ns, name): +- for repo in includes.values(): +- if repo.namespace.name != ns: +- continue +- iface = repo.namespace.find_interface(name) +- if iface is not None: +- return Type(name=f"{repo.namespace.name}.{iface.name}", ctype=iface.ctype) +- return None ++ repository = includes.get(ns) ++ if repository is None: ++ return None ++ iface = repository.namespace.find_interface(name) ++ # If the interface type is unqualified, then we qualify it here ++ if '.' not in iface.name: ++ iface.name = f"{repository.namespace.name}.{iface.name}" ++ return iface + + classes = self.namespace.get_classes() + for cls in classes: +diff --git a/gidocgen/gir/parser.py b/gidocgen/gir/parser.py +index cdab096..df155cb 100644 +--- a/gidocgen/gir/parser.py ++++ b/gidocgen/gir/parser.py +@@ -96,7 +96,7 @@ class GirParser: + repository.girfile = girfile.name + self._repository = repository + self._repository.resolve_empty_ctypes(self._seen_types) +- self._repository.resolve_class_type() ++ self._repository.resolve_class_ctype() + self._repository.resolve_class_implements() + self._repository.resolve_class_ancestors() + self._repository.resolve_class_descendants() +-- +GitLab + diff --git a/gi-docgen-2021.7.tar.gz b/gi-docgen-2021.7.tar.gz deleted file mode 100644 index 4386f8c..0000000 --- a/gi-docgen-2021.7.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0fd3f22b02204931d8feb4279fa00d4310d0b8a1f94d14025d440cddb4fe3e0a -size 1258424 diff --git a/gi-docgen-2021.8.tar.gz b/gi-docgen-2021.8.tar.gz new file mode 100644 index 0000000..2994661 --- /dev/null +++ b/gi-docgen-2021.8.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5479f14fd7c918c5d5445b89ef35db1b1d3e95834c723881cdfc3c3aa048d18e +size 1261322 diff --git a/python-gi-docgen.changes b/python-gi-docgen.changes index 03ea219..cfa8dce 100644 --- a/python-gi-docgen.changes +++ b/python-gi-docgen.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Oct 29 20:53:40 UTC 2021 - Bjørn Lie + +- Add 114.patch: gir: Do not qualify type names that are already + qualified. + ------------------------------------------------------------------- Tue Oct 26 08:29:13 UTC 2021 - Yifan Jiang @@ -7,6 +13,25 @@ Tue Oct 26 08:29:13 UTC 2021 - Yifan Jiang https://github.com/Python-Markdown/markdown/commit/1f3ec538a2acf25607253fc7c7a992950463931d +------------------------------------------------------------------- +Fri Oct 22 08:35:30 UTC 2021 - Bjørn Lie + +- Update to version 2021.8: + + Allow `id` fragments to link across namespace boundaries + + Support links to have custom text + + Decrease the max font size + + Improve output for properties and signals + + Save last search in the history + + Don't crash on unlabelled array elements + + Move type functions near constructors + + Switch to Solarized for syntax highlighting + + Use the C type for callback types in search results + + Generate proper cross-reference links + + Parse and use new gobject-introspection property attributes + + Properly identify (type, gpointer) types + + List the interface implementations in a namespace + + List the class descendants in a namespace + ------------------------------------------------------------------- Tue Aug 17 11:10:23 UTC 2021 - Bjørn Lie diff --git a/python-gi-docgen.spec b/python-gi-docgen.spec index efafa9a..f364899 100644 --- a/python-gi-docgen.spec +++ b/python-gi-docgen.spec @@ -18,12 +18,15 @@ %define pythons python3 Name: python-gi-docgen -Version: 2021.7 +Version: 2021.8 Release: 0 Summary: Documentation tool for GObject-based libraries License: Apache-2.0 AND GPL-3.0-or-later AND CC0-1.0 URL: https://gitlab.gnome.org/ebassi/gi-docgen Source: https://files.pythonhosted.org/packages/source/g/gi-docgen/gi-docgen-%{version}.tar.gz +# PATCH-FIX-UPSTREAM 114.patch -- gir: Do not qualify type names that are already qualified +Patch: https://gitlab.gnome.org/GNOME/gi-docgen/-/merge_requests/114.patch + BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel} BuildRequires: python-rpm-macros @@ -52,7 +55,7 @@ BuildArch: noarch Documentation tool for GObject-based libraries %prep -%setup -q -n gi-docgen-%{version} +%autosetup -n gi-docgen-%{version} -p1 %build %python_build