diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-06-17 02:09:02 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-06-17 22:30:43 +0900 |
commit | 9bef665cb84d4a7ee17fa7b3f6544dae825b170d (patch) | |
tree | 14f056da0a2fbf99899c3879572deaac90db3800 /sphinx/builders/html.py | |
parent | 564d23be7ac001aaa172aaf05cdc6e46e2fb9ba7 (diff) | |
download | sphinx-git-9bef665cb84d4a7ee17fa7b3f6544dae825b170d.tar.gz |
validate html_static_path on config-inited
Diffstat (limited to 'sphinx/builders/html.py')
-rw-r--r-- | sphinx/builders/html.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 1fd9e6cac..a21aeb798 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -783,9 +783,6 @@ class StandaloneHTMLBuilder(Builder): excluded = Matcher(self.config.exclude_patterns + ["**/.*"]) for static_path in self.config.html_static_path: entry = path.join(self.confdir, static_path) - if not path.exists(entry): - logger.warning(__('html_static_path entry %r does not exist'), entry) - continue copy_asset(entry, path.join(self.outdir, '_static'), excluded, context=ctx, renderer=self.templates) # copy logo and favicon files if not already in static path @@ -1166,6 +1163,14 @@ def validate_math_renderer(app: Sphinx) -> None: raise ConfigError(__('Unknown math_renderer %r is given.') % name) +def validate_html_static_path(app: Sphinx, config: Config) -> None: + """Check html_static_paths setting.""" + for entry in config.html_static_path[:]: + if not path.exists(path.join(app.confdir, entry)): + logger.warning(__('html_static_path entry %r does not exist'), entry) + config.html_static_path.remove(entry) + + # for compatibility import sphinx.builders.dirhtml # NOQA import sphinx.builders.singlehtml # NOQA @@ -1221,6 +1226,7 @@ def setup(app: Sphinx) -> Dict[str, Any]: # event handlers app.connect('config-inited', convert_html_css_files) app.connect('config-inited', convert_html_js_files) + app.connect('config-inited', validate_html_static_path) app.connect('builder-inited', validate_math_renderer) app.connect('html-page-context', setup_js_tag_helper) |