Skip to content

Commit f123cff

Browse files
mchehabJonathan Corbet
authored andcommitted
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>
1 parent d0b31c3 commit f123cff

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

Documentation/conf.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313

1414
import sphinx
1515

16-
# If extensions (or modules to document with autodoc) are in another directory,
17-
# add these directories to sys.path here. If the directory is relative to the
18-
# documentation root, use os.path.abspath to make it absolute, like shown here.
19-
sys.path.insert(0, os.path.abspath("sphinx"))
16+
# Location of Documentation/ directory
17+
kern_doc_dir = os.path.dirname(os.path.abspath(__file__))
18+
19+
# Add location of Sphinx extensions
20+
sys.path.insert(0, os.path.join(kern_doc_dir, "sphinx"))
2021

2122
# Minimal supported version
2223
needs_sphinx = "3.4.3"
@@ -32,9 +33,6 @@
3233
# Include patterns that don't contain directory names, in glob format
3334
include_patterns = ["**.rst"]
3435

35-
# Location of Documentation/ directory
36-
kern_doc_dir = os.path.abspath(".")
37-
3836
# Exclude of patterns that don't contain directory names, in glob format.
3937
exclude_patterns = []
4038

0 commit comments

Comments
 (0)