2023-09-28 00:14:00

by Akira Yokosawa

[permalink] [raw]
Subject: Re: [PATCH] docs/sphinx: Explicitly convert Sphinx paths to str

Hi,

On Sun, 10 Sep 2023 00:08:06 -0400, Oliver Faso wrote:
> Sphinx 7.2+ is switching to using pathlib.Path
> instead of str to represent paths. This fixes the
> current deprecation warnings and eventual breakage.
> This conversion will be a no-op when using older
> Sphinx versions.
>
> Signed-off-by: Oliver Faso <[email protected]>

Belatedly tested against Sphinx versions 2.4.5, 4.2.0, 5.3.0,
and 7.2.6 (latest).

Tested-by: Akira Yokosawa <[email protected]>

HTH, Akira

> ---
> Documentation/sphinx/kerneldoc.py | 2 +-
> Documentation/sphinx/kfigure.py | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerneldoc.py
> index 9395892c7ba3..d26155990ec3 100644
> --- a/Documentation/sphinx/kerneldoc.py
> +++ b/Documentation/sphinx/kerneldoc.py
> @@ -138,7 +138,7 @@ class KernelDocDirective(Directive):
> lineoffset = int(match.group(1)) - 1
> # we must eat our comments since the upset the markup
> else:
> - doc = env.srcdir + "/" + env.docname + ":" + str(self.lineno)
> + doc = str(env.srcdir) + "/" + env.docname + ":" + str(self.lineno)
> result.append(line, doc + ": " + filename, lineoffset)
> lineoffset += 1
>
> diff --git a/Documentation/sphinx/kfigure.py b/Documentation/sphinx/kfigure.py
> index cefdbb7e7523..13e885bbd499 100644
> --- a/Documentation/sphinx/kfigure.py
> +++ b/Documentation/sphinx/kfigure.py
> @@ -309,7 +309,7 @@ def convert_image(img_node, translator, src_fname=None):
> if dst_fname:
> # the builder needs not to copy one more time, so pop it if exists.
> translator.builder.images.pop(img_node['uri'], None)
> - _name = dst_fname[len(translator.builder.outdir) + 1:]
> + _name = dst_fname[len(str(translator.builder.outdir)) + 1:]
>
> if isNewer(dst_fname, src_fname):
> kernellog.verbose(app,
> --
> 2.42.0
>