DTS is using a specific configuration of Sphinx
which is supported only with the theme Read The Docs.
If not available, this error may be seen:
        unsupported theme option 'collapse_navigation' given

In order to allow doc generation without this theme,
a check is added to make the specific configuration optional.

Fixes: 7f9326423a04 ("dts: add API doc generation")

Signed-off-by: Thomas Monjalon <tho...@monjalon.net>
Signed-off-by: Robin Jarry <rja...@redhat.com>
---
 doc/guides/conf.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/doc/guides/conf.py b/doc/guides/conf.py
index 200e98b0bc..b553d9d5bf 100644
--- a/doc/guides/conf.py
+++ b/doc/guides/conf.py
@@ -16,13 +16,12 @@
 
 try:
     import sphinx_rtd_theme
-
     html_theme = "sphinx_rtd_theme"
-except:
+except ImportError:
     print('Install the sphinx ReadTheDocs theme for improved html 
documentation '
           'layout: https://sphinx-rtd-theme.readthedocs.io/',
           file=stderr)
-    pass
+    html_theme = "default"
 
 stop_on_error = ('-W' in argv)
 
@@ -85,10 +84,11 @@
     toc_object_entries = True
     toc_object_entries_show_parents = 'hide'
     # DTS Sidebar config.
-    html_theme_options = {
-        'collapse_navigation': False,
-        'navigation_depth': -1,  # unlimited depth
-    }
+    if html_theme == "sphinx_rtd_theme":
+        html_theme_options = {
+            'collapse_navigation': False,
+            'navigation_depth': -1,  # unlimited depth
+        }
 
     # Add path to DTS sources so that Sphinx can find them.
     dpdk_root = dirname(dirname(dirname(__file__)))
-- 
2.46.0

Reply via email to