Skip to content

Commit 9289f61

Browse files
committed
FIX: build a directory if it does not exist
1 parent def41cc commit 9289f61

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc/sphinxext/redirect_from.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def _generate_redirects(app, exception):
7777
if builder.name != "html" or exception:
7878
return
7979
for k, v in RedirectFrom.redirects.items():
80-
with Path(app.outdir, k + builder.out_suffix).open("w") as file:
80+
p = Path(app.outdir, k + builder.out_suffix)
81+
Path(*p.parts[:-1]).mkdir(parents=True, exist_ok=True)
82+
with p.open("x") as file:
8183
logger.info('making refresh html file: ' + k + ' redirect to ' + v)
8284
file.write(HTML_TEMPLATE.format(v=v))

0 commit comments

Comments
 (0)