Conditionally import OPNFV Theme 56/8656/2
authorTrevor Bramwell <tbramwell@linuxfoundation.org>
Fri, 2 Feb 2018 19:31:39 +0000 (11:31 -0800)
committerTrevor Bramwell <tbramwell@linuxfoundation.org>
Fri, 2 Feb 2018 21:02:54 +0000 (13:02 -0800)
When using the 'opnfv' theme, conf.py needs to run the Python code
'sphinx_opnfv_theme.get_html_theme_path()' in order
to determine the location of package data on the filesystem.

Instead of having every project that wants to use the OPNFV theme set
this explicitly in their conf.py, we conditionally import the theme and
execute the code.

Change-Id: Ic686483fd511bf5e321977c2802f4cfb8986c800
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
docs_conf/conf.py

index b7be897..c66aa4d 100644 (file)
@@ -99,7 +99,11 @@ html_theme_options = cfg.get('html_theme_options', {
     'navbar_sidebarrel': False,
     'source_link_position': "footer",
 })
-html_theme_path = cfg.get('html_theme_path', sphinx_bootstrap_theme.get_html_theme_path())
+if html_theme == 'opnfv':
+    import sphinx_opnfv_theme
+    html_theme_path = sphinx_opnfv_theme.get_html_theme_path()
+else:
+    html_theme_path = cfg.get('html_theme_path', sphinx_bootstrap_theme.get_html_theme_path())
 htmlhelp_basename = cfg.get('htmlhelp_basename', 'DocsConf')
 
 intersphinx_mapping = {