Re: [PATCH v8 13/13] docs: parser_yaml.py: fix backward compatibility with old docutils

Akira Yokosawa <[email protected]>
Newsgroups dev.linux.lists.lkmm,dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>
Hi Mauro,

On Thu, 26 Jun 2025 10:13:09 +0200, Mauro Carvalho Chehab wrote:
> As reported by Akira, older docutils versions are not compatible
> with the way some Sphinx versions send tab_width. Add a code to
> address it.
> 

Tested OK against debian:11's and almalinux:9's Sphinx 3.4.3, both of
which have docutils 0.16 bundled.

opensuse/leap:15.6's Sphinx 4.2.0 has docutils 0.16 with it, but it is
python 3.6 base and it does't work with the ynl integration.
As opensuse/leap:15.6 provides Sphinx 7.2.6 (on top of python 3.11) as
an alternative, obsoleting it should be acceptable.  

Reported-by: Akira Yokosawa <[email protected]>
> Closes: https://lore.kernel.org/linux-doc/[email protected]/
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Tested-by: Akira Yokosawa <[email protected]>

        Thanks, Akira

> ---
>  Documentation/sphinx/parser_yaml.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/sphinx/parser_yaml.py b/Documentation/sphinx/parser_yaml.py
> index 8288e2ff7c7c..1602b31f448e 100755
> --- a/Documentation/sphinx/parser_yaml.py
> +++ b/Documentation/sphinx/parser_yaml.py
> @@ -77,6 +77,10 @@ class YamlParser(Parser):
>  
>                  result.append(line, document.current_source, lineoffset)
>  
> +            # Fix backward compatibility with docutils < 0.17.1
> +            if "tab_width" not in vars(document.settings):
> +                document.settings.tab_width = 8
> +
>              rst_parser = RSTParser()
>              rst_parser.parse('\n'.join(result), document)
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.