Module: Mesa
Branch: master
Commit: 7daf953bc0e67f4f205560138f8fdedb2ec6ca57
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7daf953bc0e67f4f205560138f8fdedb2ec6ca57

Author: Erik Faye-Lund <[email protected]>
Date:   Wed Oct 21 13:38:23 2020 +0200

docs: verify that targets for relative redirects exist

This makes it a bit easier to update the redirects.

Reviewed-by: Eric Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7174>

---

 docs/_exts/redirects.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/_exts/redirects.py b/docs/_exts/redirects.py
index 0320f2c21aa..4528189956e 100644
--- a/docs/_exts/redirects.py
+++ b/docs/_exts/redirects.py
@@ -1,4 +1,5 @@
 import os
+from urllib.parse import urlparse
 
 redirects = [
     ('llvmpipe', 'gallium/drivers/llvmpipe.html'),
@@ -15,7 +16,13 @@ def create_redirects(app, docname):
         return
     for src, dst in redirects:
         path = os.path.join(app.outdir, '{0}.html'.format(src))
+
         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:
             f.write(create_redirect(dst))
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to