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 * #1789: ``:pyobject:`` option of ``literalinclude`` directive includes following
lines after class definitions lines after class definitions
* #1790: ``literalinclude`` strips empty lines at the head and tail * #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) Release 1.3.1 (released Mar 17, 2015)

View File

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