summaryrefslogtreecommitdiff
path: root/sphinx/theming.py
diff options
context:
space:
mode:
authorvitaut <victor.zverovich@gmail.com>2015-10-16 06:58:12 -0700
committervitaut <victor.zverovich@gmail.com>2015-10-16 06:58:12 -0700
commit12dde8afdb0a7bb5576e2656692c3478c69d8cc3 (patch)
tree8228fb4d74ee62ddd8bcb75f568a449d18dcf9b8 /sphinx/theming.py
parent5f09ecd4cf3749ec250d3b6773dd5467a6d3bcd1 (diff)
downloadsphinx-git-12dde8afdb0a7bb5576e2656692c3478c69d8cc3.tar.gz
Make sphinx_rtd_theme optional
Diffstat (limited to 'sphinx/theming.py')
-rw-r--r--sphinx/theming.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/sphinx/theming.py b/sphinx/theming.py
index 49bd707d0..6be331194 100644
--- a/sphinx/theming.py
+++ b/sphinx/theming.py
@@ -27,7 +27,6 @@ from sphinx import package_dir
from sphinx.errors import ThemeError
import alabaster
-import sphinx_rtd_theme
NODEFAULT = object()
THEMECONF = 'theme.conf'
@@ -71,7 +70,13 @@ class Theme(object):
@classmethod
def load_extra_theme(cls, name):
- if name in ('alabaster', 'sphinx_rtd_theme'):
+ themes = ['alabaster']
+ try:
+ import sphinx_rtd_theme
+ themes.append('sphinx_rtd_theme')
+ except ImportError:
+ pass
+ if name in themes:
if name == 'alabaster':
themedir = alabaster.get_path()
# alabaster theme also requires 'alabaster' extension, it will be loaded