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:
  1f3ec538a2
- 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
This commit is contained in:
Bjørn Lie 2021-12-17 21:39:11 +00:00 committed by Git OBS Bridge
parent 14ec69f42f
commit 5747b871a5
5 changed files with 155 additions and 5 deletions

122
114.patch Normal file
View File

@ -0,0 +1,122 @@
From 72f3c5dbe27aabb5f7a376afda23f3dfc3c2e212 Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@gnome.org>
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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0fd3f22b02204931d8feb4279fa00d4310d0b8a1f94d14025d440cddb4fe3e0a
size 1258424

3
gi-docgen-2021.8.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5479f14fd7c918c5d5445b89ef35db1b1d3e95834c723881cdfc3c3aa048d18e
size 1261322

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Oct 29 20:53:40 UTC 2021 - Bjørn Lie <bjorn.lie@gmail.com>
- Add 114.patch: gir: Do not qualify type names that are already
qualified.
-------------------------------------------------------------------
Tue Oct 26 08:29:13 UTC 2021 - Yifan Jiang <yfjiang@suse.com>
@ -7,6 +13,25 @@ Tue Oct 26 08:29:13 UTC 2021 - Yifan Jiang <yfjiang@suse.com>
https://github.com/Python-Markdown/markdown/commit/1f3ec538a2acf25607253fc7c7a992950463931d
-------------------------------------------------------------------
Fri Oct 22 08:35:30 UTC 2021 - Bjørn Lie <bjorn.lie@gmail.com>
- 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 <bjorn.lie@gmail.com>

View File

@ -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