From b9d88490bb819e83ed966b397dc1daff4e9765a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Neusch=C3=A4fer?= Date: Thu, 1 Jan 2026 15:31:06 +0100 Subject: docs: kdoc: handle the obsolescensce of docutils.ErrorString() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ErrorString() and SafeString() docutils functions were helpers meant to ease the handling of encodings during the Python 3 transition. There is no real need for them after Python 3.6, and docutils 0.22 removes them, breaking the docs build Handle this by just injecting our own one-liner version of ErrorString(), and removing the sole SafeString() call entirely. Reported-by: Zhixu Liu Signed-off-by: Jonathan Corbet Upstream: https://git.kernel.org/linus/00d95fcc4dee66dfb6980de6f2973b32f973a1eb [j.ne: Adapted from Linux to U-Boot] Signed-off-by: J. Neuschäfer Reviewed-by: Heinrich Schuchardt --- doc/sphinx/kernel_include.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'doc/sphinx/kernel_include.py') diff --git a/doc/sphinx/kernel_include.py b/doc/sphinx/kernel_include.py index f523aa68a36..6522de9dd69 100755 --- a/doc/sphinx/kernel_include.py +++ b/doc/sphinx/kernel_include.py @@ -34,11 +34,13 @@ u""" import os.path from docutils import io, nodes, statemachine -from docutils.utils.error_reporting import SafeString, ErrorString from docutils.parsers.rst import directives from docutils.parsers.rst.directives.body import CodeBlock, NumberLines from docutils.parsers.rst.directives.misc import Include +def ErrorString(exc): # Shamelessly stolen from docutils + return f'{exc.__class__.__name}: {exc}' + __version__ = '1.0' # ============================================================================== @@ -109,7 +111,7 @@ class KernelInclude(Include): raise self.severe('Problems with "%s" directive path:\n' 'Cannot encode input file path "%s" ' '(wrong locale?).' % - (self.name, SafeString(path))) + (self.name, path)) except IOError as error: raise self.severe('Problems with "%s" directive path:\n%s.' % (self.name, ErrorString(error))) -- cgit v1.2.3