From 32591a7f7787dc2dcabb0cea197a3c7c536d8ab8 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sat, 24 Oct 2015 19:18:40 +0300 Subject: [PATCH] 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. --- sphinx/theming.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sphinx/theming.py b/sphinx/theming.py index b4d940dfe5c..4b885a22e84 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -26,9 +26,6 @@ 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 @@ def init_themes(cls, confdir, theme_path, warn=None): 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')