docs: do not generate redirects on error

The build-finished event is also triggered when there's an error. I
somehow got the second argument wrong, and ended up ignoring the case.
This can lead to new exceptions being thrown due to missing files, that
ends up hiding the real problem.

Fixes: 64a4ba9e1c ("docs: add an extension to generate redirects")
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10407>
This commit is contained in:
Erik Faye-Lund
2021-04-22 13:46:41 +02:00
committed by Marge Bot
parent 5a1675a030
commit 2736370294

View File

@@ -6,8 +6,8 @@ def create_redirect(dst):
tpl = '<html><head><meta http-equiv="refresh" content="0; url={0}"><script>window.location.replace("{0}")</script></head></html>' tpl = '<html><head><meta http-equiv="refresh" content="0; url={0}"><script>window.location.replace("{0}")</script></head></html>'
return tpl.format(dst) return tpl.format(dst)
def create_redirects(app, docname): def create_redirects(app, exception):
if not app.builder.name == 'html': if exception is not None or not app.builder.name == 'html':
return return
for src, dst in app.config.html_redirects: for src, dst in app.config.html_redirects:
path = os.path.join(app.outdir, '{0}.html'.format(src)) path = os.path.join(app.outdir, '{0}.html'.format(src))