docs: verify that targets for relative redirects exist
This makes it a bit easier to update the redirects. Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7174>
This commit is contained in:

committed by
Marge Bot

parent
a85c3189fa
commit
7daf953bc0
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
redirects = [
|
redirects = [
|
||||||
('llvmpipe', 'gallium/drivers/llvmpipe.html'),
|
('llvmpipe', 'gallium/drivers/llvmpipe.html'),
|
||||||
@@ -15,7 +16,13 @@ def create_redirects(app, docname):
|
|||||||
return
|
return
|
||||||
for src, dst in redirects:
|
for src, dst in redirects:
|
||||||
path = os.path.join(app.outdir, '{0}.html'.format(src))
|
path = os.path.join(app.outdir, '{0}.html'.format(src))
|
||||||
|
|
||||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||||
|
|
||||||
|
if urlparse(dst).scheme == "":
|
||||||
|
if not os.path.isfile(os.path.join(os.path.dirname(path), dst)):
|
||||||
|
raise Exception('{0} does not exitst'.format(dst))
|
||||||
|
|
||||||
with open(path, 'w') as f:
|
with open(path, 'w') as f:
|
||||||
f.write(create_redirect(dst))
|
f.write(create_redirect(dst))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user