]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
scripts/kerneldoc: Switch to the Python kernel-doc script
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 14 Aug 2025 17:13:21 +0000 (18:13 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Sat, 30 Aug 2025 15:37:23 +0000 (16:37 +0100)
Change the Sphinx config to run the new Python kernel-doc script
instead of the Perl one.  The only difference between the two is that
the new script does not handle the -sphinx-version option, instead
assuming that Sphinx is always at least version 3: so we must
delete the code that passes that option to avoid the Python
script complaining about an unknown option.

QEMU's minimum Sphinx version is already 3.4.3, so this doesn't
change the set of versions we can handle.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Message-id: 20250814171324.1614516-7-peter.maydell@linaro.org

docs/conf.py
docs/sphinx/kerneldoc.py

index f892a6e1da3769b360df9c6ad7dbca6e2821b6d5..e09769e5f83d48613264f201731e768d95a656da 100644 (file)
@@ -341,7 +341,9 @@ man_make_section_directory = False
 # We use paths starting from qemu_docdir here so that you can run
 # sphinx-build from anywhere and the kerneldoc extension can still
 # find everything.
-kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')]
+# Since kernel-doc is now a Python script, we should run it with whatever
+# Python this sphinx is using (rather than letting it find one via env)
+kerneldoc_bin = [sys.executable, os.path.join(qemu_docdir, '../scripts/kernel-doc.py')]
 kerneldoc_srctree = os.path.join(qemu_docdir, '..')
 hxtool_srctree = os.path.join(qemu_docdir, '..')
 qapidoc_srctree = os.path.join(qemu_docdir, '..')
index 30bb3431983874db87ad29a87ba07ed11aed6b39..9721072e47685c02080f8bd941fb4ee7ee180483 100644 (file)
@@ -63,11 +63,6 @@ class KernelDocDirective(Directive):
         env = self.state.document.settings.env
         cmd = env.config.kerneldoc_bin + ['-rst', '-enable-lineno']
 
-        # Pass the version string to kernel-doc, as it needs to use a different
-        # dialect, depending what the C domain supports for each specific
-        # Sphinx versions
-        cmd += ['-sphinx-version', sphinx.__version__]
-
         # Pass through the warnings-as-errors flag
         if env.config.kerneldoc_werror:
             cmd += ['-Werror']