mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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.
This commit is contained in:
parent
0329edc510
commit
32591a7f77
@ -26,9 +26,6 @@ except ImportError:
|
|||||||
from sphinx import package_dir
|
from sphinx import package_dir
|
||||||
from sphinx.errors import ThemeError
|
from sphinx.errors import ThemeError
|
||||||
|
|
||||||
import alabaster
|
|
||||||
import sphinx_rtd_theme
|
|
||||||
|
|
||||||
NODEFAULT = object()
|
NODEFAULT = object()
|
||||||
THEMECONF = 'theme.conf'
|
THEMECONF = 'theme.conf'
|
||||||
|
|
||||||
@ -73,10 +70,12 @@ class Theme(object):
|
|||||||
def load_extra_theme(cls, name):
|
def load_extra_theme(cls, name):
|
||||||
if name in ('alabaster', 'sphinx_rtd_theme'):
|
if name in ('alabaster', 'sphinx_rtd_theme'):
|
||||||
if name == 'alabaster':
|
if name == 'alabaster':
|
||||||
|
import alabaster
|
||||||
themedir = alabaster.get_path()
|
themedir = alabaster.get_path()
|
||||||
# alabaster theme also requires 'alabaster' extension, it will be loaded
|
# alabaster theme also requires 'alabaster' extension, it will be loaded
|
||||||
# at sphinx.application module.
|
# at sphinx.application module.
|
||||||
elif name == 'sphinx_rtd_theme':
|
elif name == 'sphinx_rtd_theme':
|
||||||
|
import sphinx_rtd_theme
|
||||||
themedir = sphinx_rtd_theme.get_html_theme_path()
|
themedir = sphinx_rtd_theme.get_html_theme_path()
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('Programming Error')
|
raise NotImplementedError('Programming Error')
|
||||||
|
Loading…
Reference in New Issue
Block a user