Skip to content

Commit a765cfe

Browse files
committed
Fix get_html_theme_path warning
1 parent 18ccd1b commit a765cfe

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docs/conf.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,18 @@
108108
# The theme to use for HTML and HTML Help pages. See the documentation for
109109
# a list of builtin themes.
110110
#
111-
import sphinx_rtd_theme
112-
113-
html_theme = "sphinx_rtd_theme"
114-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
111+
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
112+
113+
if not on_rtd: # only import and set the theme if we're building docs locally
114+
try:
115+
import sphinx_rtd_theme
116+
html_theme = 'sphinx_rtd_theme'
117+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
118+
except:
119+
html_theme = 'default'
120+
html_theme_path = ['.']
121+
else:
122+
html_theme_path = ['.']
115123

116124
# Add any paths that contain custom static files (such as style sheets) here,
117125
# relative to this directory. They are copied after the builtin static files,

0 commit comments

Comments
 (0)