From: Trevor Bramwell Date: Fri, 2 Feb 2018 19:31:39 +0000 (-0800) Subject: Conditionally import OPNFV Theme X-Git-Tag: v0.2.1~9^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F56%2F8656%2F2;p=releng%2Fdocs-conf.git 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 --- 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 = {