Skip to content

Commit

Permalink
Make alabaster and sphinx_rtd_theme dependencies optional
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mitya57 committed Jan 19, 2016
1 parent 0329edc commit 32591a7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sphinx/theming.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 32591a7

Please sign in to comment.