From 346bfb707980807c0dafdce07b08514fe2217709 Mon Sep 17 00:00:00 2001 From: Trevor Bramwell Date: Fri, 2 Feb 2018 11:31:39 -0800 Subject: [PATCH] Conditionally import OPNFV Theme 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 --- docs_conf/conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs_conf/conf.py b/docs_conf/conf.py index b7be897..c66aa4d 100644 --- a/docs_conf/conf.py +++ b/docs_conf/conf.py @@ -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 = { -- 2.16.6