]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
docs: enable Sphinx autodoc extension to allow documenting python
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 19 Jan 2026 16:23:07 +0000 (17:23 +0100)
committerJonathan Corbet <corbet@lwn.net>
Fri, 23 Jan 2026 18:37:38 +0000 (11:37 -0700)
Adding python documentation is simple with Sphinx: all we need
is to include the ext.autodoc extension and add the directories
where the Python code sits at the sys.path.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <29cbe375dc418d6fa5793f55199799b5b52dcd38.1768838938.git.mchehab+huawei@kernel.org>

Documentation/conf.py

index f0367c48adc63a235d5495fddbc5ddafc85cbd64..8e786fe6007ff6c23db5b03f9ecb1ebc8f1dd215 100644 (file)
@@ -19,6 +19,10 @@ kern_doc_dir = os.path.dirname(os.path.abspath(__file__))
 # Add location of Sphinx extensions
 sys.path.insert(0, os.path.join(kern_doc_dir, "sphinx"))
 
+# Allow sphinx.ext.autodoc to document files at tools and scripts
+sys.path.append(os.path.join(kern_doc_dir, "..", "tools"))
+sys.path.append(os.path.join(kern_doc_dir, "..", "scripts"))
+
 # Minimal supported version
 needs_sphinx = "3.4.3"
 
@@ -152,6 +156,7 @@ extensions = [
     "maintainers_include",
     "parser_yaml",
     "rstFlatTable",
+    "sphinx.ext.autodoc",
     "sphinx.ext.autosectionlabel",
     "sphinx.ext.ifconfig",
     "translations",