docs: specify redirects relative to docs-root
It's a lot easier to reason about redirects if they're specified relative to thje docs-root, so let's do that instead. Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7174>
This commit is contained in:
parent
7daf953bc0
commit
47f52e83d1
1 changed files with 2 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import pathlib
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
redirects = [
|
redirects = [
|
||||||
|
|
@ -20,6 +21,7 @@ def create_redirects(app, docname):
|
||||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||||
|
|
||||||
if urlparse(dst).scheme == "":
|
if urlparse(dst).scheme == "":
|
||||||
|
dst = pathlib.posixpath.relpath(dst, start=os.path.dirname(src))
|
||||||
if not os.path.isfile(os.path.join(os.path.dirname(path), dst)):
|
if not os.path.isfile(os.path.join(os.path.dirname(path), dst)):
|
||||||
raise Exception('{0} does not exitst'.format(dst))
|
raise Exception('{0} does not exitst'.format(dst))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue