From 66904da6ce82f7b7ba4c3f8a1645805753f2c53f Mon Sep 17 00:00:00 2001 From: Stanislav Hanzhin-Tsvetkov Date: Tue, 24 Dec 2024 11:52:27 +0200 Subject: [PATCH] doc: support sphinx versions above 7.3.0 sphinx rearranged code for python domain splitting it into smaller parts, so versions newer or equal 7.3.0 have this function in different place. Dagor has moved to sphinx 8+ for documentation and we need this change. Sphinx8 has mostly deprecated string-like paths and is now (almost everywhere) using PathLike objects for which addition with strings is not possible, so f-strings are now required --- doc/source/daslang.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/source/daslang.py b/doc/source/daslang.py index a598a54dd..7ec645259 100644 --- a/doc/source/daslang.py +++ b/doc/source/daslang.py @@ -14,10 +14,15 @@ from docutils import nodes from docutils.parsers.rst import directives +from sphinx import version_info + from sphinx import addnodes from sphinx.directives import ObjectDescription from sphinx.domains import Domain, ObjType -from sphinx.domains.python import _pseudo_parse_arglist +if version_info >= (7, 3, 0): + from sphinx.domains.python._annotations import _pseudo_parse_arglist +else: + from sphinx.domains.python import _pseudo_parse_arglist from sphinx.locale import _ from sphinx.roles import XRefRole from sphinx.util.docfields import Field, GroupedField, TypedField @@ -114,9 +119,8 @@ def add_target_and_index(self, name_obj, sig, signode): objects = self.env.domaindata['das']['objects'] if fullname in objects: self.state_machine.reporter.warning( - 'duplicate object description of %s, ' % fullname + - 'other instance in ' + - self.env.doc2path(objects[fullname][0]), + f'duplicate object description of {fullname}, ' + + f'other instance in {self.env.doc2path(objects[fullname][0])}', line=self.lineno) objects[fullname] = self.env.docname, self.objtype