summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2026-01-19 17:23:06 +0100
committerJonathan Corbet <corbet@lwn.net>2026-01-23 11:37:38 -0700
commitf123cffb000987bfc04f2463cc33bae2b2c1d590 (patch)
treebaf7285688f6391e3389c5a5493a48bf33f2e27b
parentd0b31c30b58c07985c993fcc9275490948de87aa (diff)
docs: conf: don't rely on cwd to get documentation location
Instead of relying that Sphinx will be called from Documentation/ dir, pick the location based on __file__. Suggested-by: Jani Nikula <jani.nikula@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <34c38718dfade91ff6f7afca5e9c1705ba253c97.1768838938.git.mchehab+huawei@kernel.org>
-rw-r--r--Documentation/conf.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 10322b1a28a7..f0367c48adc6 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -13,10 +13,11 @@ from textwrap import dedent
import sphinx
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-sys.path.insert(0, os.path.abspath("sphinx"))
+# Location of Documentation/ directory
+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"))
# Minimal supported version
needs_sphinx = "3.4.3"
@@ -32,9 +33,6 @@ else:
# Include patterns that don't contain directory names, in glob format
include_patterns = ["**.rst"]
-# Location of Documentation/ directory
-kern_doc_dir = os.path.abspath(".")
-
# Exclude of patterns that don't contain directory names, in glob format.
exclude_patterns = []