From: Ondrej Lichtner <olichtne(a)redhat.com>
Depending on where the 'sphinx-build' is called from, the relative
import path of '../'+sys.path didn't always work. This fixes the issue
by defining the path as relative to location of the conf.py file.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
docs/source/conf.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/docs/source/conf.py b/docs/source/conf.py
index e8784ca..49d3c6b 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -10,9 +10,15 @@
# 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.
#
-# import os
-# import sys
-# sys.path.insert(0, os.path.abspath('.'))
+import os
+import sys
+import pathlib
+sys.path.insert(
+ 0,
+ os.path.abspath(
+ os.path.join(pathlib.Path(__file__).parent.absolute(), "../../")
+ ),
+)
# -- Project information -----------------------------------------------------
@@ -31,9 +37,6 @@
'sphinx.ext.autodoc',
]
-import sys
-sys.path = ['../'] + sys.path
-
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
--
2.26.2