DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] doc: fix Sphinx build without RTD theme
@ 2024-10-17 17:14 Thomas Monjalon
  2024-10-18 10:18 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Monjalon @ 2024-10-17 17:14 UTC (permalink / raw)
  To: dev
  Cc: Robin Jarry, Juraj Linkeš, Luca Vizzarro, Dean Marx, Jeremy Spewock

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 <thomas@monjalon.net>
Signed-off-by: Robin Jarry <rjarry@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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-18 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-17 17:14 [PATCH] doc: fix Sphinx build without RTD theme Thomas Monjalon
2024-10-18 10:18 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).