summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2015-10-24 19:18:40 +0300
committerDmitry Shachnev <mitya57@gmail.com>2016-01-19 14:34:02 +0300
commit32591a7f7787dc2dcabb0cea197a3c7c536d8ab8 (patch)
tree3585f0e1d075e2cfbbb2b7d383a8cb4fede0fe30
parent0329edc5107bae03342e7ca446a3d03ab8adeb13 (diff)
downloadsphinx-git-32591a7f7787dc2dcabb0cea197a3c7c536d8ab8.tar.gz
Make alabaster and sphinx_rtd_theme dependencies optional
There is no need to pull these dependencies if i.e. the documentation is using the classic theme. There will be no change in behavior for projects using alabaster or sphinx_rtd_theme.
-rw-r--r--sphinx/theming.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/sphinx/theming.py b/sphinx/theming.py
index b4d940dfe..4b885a22e 100644
--- a/sphinx/theming.py
+++ b/sphinx/theming.py
@@ -26,9 +26,6 @@ except ImportError:
from sphinx import package_dir
from sphinx.errors import ThemeError
-import alabaster
-import sphinx_rtd_theme
-
NODEFAULT = object()
THEMECONF = 'theme.conf'
@@ -73,10 +70,12 @@ class Theme(object):
def load_extra_theme(cls, name):
if name in ('alabaster', 'sphinx_rtd_theme'):
if name == 'alabaster':
+ import alabaster
themedir = alabaster.get_path()
# alabaster theme also requires 'alabaster' extension, it will be loaded
# at sphinx.application module.
elif name == 'sphinx_rtd_theme':
+ import sphinx_rtd_theme
themedir = sphinx_rtd_theme.get_html_theme_path()
else:
raise NotImplementedError('Programming Error')