File tree 1 file changed +7
-6
lines changed 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,13 @@ def _generate_redirects(app, exception):
76
76
return
77
77
for k , v in RedirectFrom .redirects .items ():
78
78
p = Path (app .outdir , k + builder .out_suffix )
79
+ html = HTML_TEMPLATE .format (v = v )
79
80
if p .is_file ():
80
- logger .warning (f'A redirect-from directive is trying to create '
81
- f'{ p } , but that file already exists (perhaps '
82
- f'you need to run "make clean")' )
81
+ if p .read_text () != html :
82
+ logger .warning (f'A redirect-from directive is trying to '
83
+ f'create { p } , but that file already exists '
84
+ f'(perhaps you need to run "make clean")' )
83
85
else :
86
+ logger .info (f'making refresh html file: { k } redirect to { v } ' )
84
87
p .parent .mkdir (parents = True , exist_ok = True )
85
- with p .open ("x" ) as file :
86
- logger .info (f'making refresh html file: { k } redirect to { v } ' )
87
- file .write (HTML_TEMPLATE .format (v = v ))
88
+ p .write_text (html )
You can’t perform that action at this time.
0 commit comments