Fix #1794: custom theme extended from alabaster or sphinx_rtd_theme can't find base theme.

This commit is contained in:
shimizukawa 2015-04-05 15:10:49 +09:00
parent 9d2ec40d8b
commit ccd7e73c19
2 changed files with 22 additions and 19 deletions

View File

@ -8,6 +8,9 @@ Bugs fixed
* #1789: ``:pyobject:`` option of ``literalinclude`` directive includes following
lines after class definitions
* #1790: ``literalinclude`` strips empty lines at the head and tail
* #1802: load plugin themes automatically when theme.conf use it as 'inherit'. Thanks to
Takayuki Hirai.
* #1794: custom theme extended from alabaster or sphinx_rtd_theme can't find base theme.
Release 1.3.1 (released Mar 17, 2015)

View File

@ -71,28 +71,28 @@ class Theme(object):
@classmethod
def load_extra_theme(cls, name):
if name == 'alabaster':
cls.themes[name] = (os.path.join(alabaster.get_path(), name), None)
# alabaster theme also requires 'alabaster' extension, it will be loaded at
# sphinx.******* module.
return
if name in ('alabaster', 'sphinx_rtd_theme'):
if name == 'alabaster':
themedir = alabaster.get_path()
# alabaster theme also requires 'alabaster' extension, it will be loaded
# at sphinx.application module.
elif name == 'sphinx_rtd_theme':
themedir = sphinx_rtd_theme.get_html_theme_path()
else:
raise NotImplementedError('Programming Error')
if name == 'sphinx_rtd_theme':
cls.themes[name] = (
os.path.join(sphinx_rtd_theme.get_html_theme_path(), name), None)
return
for themedir in load_theme_plugins():
if not path.isdir(themedir):
continue
for theme in os.listdir(themedir):
if theme != name:
continue
if not path.isfile(path.join(themedir, theme, THEMECONF)):
continue
cls.themes[theme] = (path.join(themedir, theme), None)
else:
for themedir in load_theme_plugins():
if path.isfile(path.join(themedir, name, THEMECONF)):
break
else:
# specified theme is not found
return
cls.themepath.append(themedir)
cls.themes[name] = (path.join(themedir, name), None)
return
def __init__(self, name, warn=None):
if name not in self.themes:
self.load_extra_theme(name)