diff options
-rw-r--r-- | sphinx/builders/changes.py | 3 | ||||
-rw-r--r-- | sphinx/builders/html.py | 3 | ||||
-rw-r--r-- | sphinx/theming.py | 11 |
3 files changed, 10 insertions, 7 deletions
diff --git a/sphinx/builders/changes.py b/sphinx/builders/changes.py index 980ed7606..488bc0374 100644 --- a/sphinx/builders/changes.py +++ b/sphinx/builders/changes.py @@ -30,7 +30,8 @@ class ChangesBuilder(Builder): def init(self): self.create_template_bridge() - Theme.init_themes(self) + Theme.init_themes(self.confdir, self.config.html_theme_path, + warn=self.warn) self.theme = Theme('default') self.templates.init(self, self.theme) diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index b85e94423..3d4370530 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -117,7 +117,8 @@ class StandaloneHTMLBuilder(Builder): return self.config.html_theme, self.config.html_theme_options def init_templates(self): - Theme.init_themes(self) + Theme.init_themes(self.confdir, self.config.html_theme_path, + warn=self.warn) themename, themeoptions = self.get_theme_config() self.theme = Theme(themename) self.theme_options = themeoptions.copy() diff --git a/sphinx/theming.py b/sphinx/theming.py index 92e63f31c..42bc44f63 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -30,13 +30,13 @@ class Theme(object): themes = {} @classmethod - def init_themes(cls, builder): + def init_themes(cls, confdir, theme_path, warn=None): """Search all theme paths for available themes.""" - cls.themepath = list(builder.config.html_theme_path) + cls.themepath = list(theme_path) cls.themepath.append(path.join(package_dir, 'themes')) for themedir in cls.themepath[::-1]: - themedir = path.join(builder.confdir, themedir) + themedir = path.join(confdir, themedir) if not path.isdir(themedir): continue for theme in os.listdir(themedir): @@ -48,8 +48,9 @@ class Theme(object): tname = theme[:-4] tinfo = zfile except Exception: - builder.warn('file %r on theme path is not a valid ' - 'zipfile or contains no theme' % theme) + if warn: + warn('file %r on theme path is not a valid ' + 'zipfile or contains no theme' % theme) continue else: if not path.isfile(path.join(themedir, theme, THEMECONF)): |