From c1b3beab118bc0d2a730b52ccc055d849be5684b Mon Sep 17 00:00:00 2001 From: Ammar Askar Date: Thu, 2 Apr 2015 21:06:59 +0500 Subject: [PATCH] Fall back to classic theme if rtd_theme not available --- docs/conf.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 0d319f4..9e20561 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -119,11 +119,16 @@ todo_include_todos = True # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -# Use RTD theme even when compiling locally. +# Attempt to use RTD theme even when compiling locally. if os.environ.get("READTHEDOCS", "") != "True": - import sphinx_rtd_theme + try: + import sphinx_rtd_theme + html_theme = "sphinx_rtd_theme" + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + except ImportError: + html_theme = "classic" +else: html_theme = "sphinx_rtd_theme" - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the