File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
1
import hashlib
2
+ import sys
2
3
from pathlib import Path
3
4
4
5
from docutils import nodes
@@ -67,7 +68,11 @@ def update_css_js(app: Sphinx):
67
68
js_path .write_text (content )
68
69
# Read the css content and hash it
69
70
content = read_text (static_module , "style.min.css" )
70
- hash = hashlib .md5 (content .encode ("utf8" ), usedforsecurity = False ).hexdigest ()
71
+ # Handle python >= 3.9 and specify md5 is not used for security reasons
72
+ # to avoid issue with FIPS
73
+ md5_has_usedforsecurity = float (sys .version [:3 ]) >= 3.9
74
+ md5_kwargs = {"usedforsecurity" : False } if md5_has_usedforsecurity else {}
75
+ hash = hashlib .md5 (content .encode ("utf8" ), ** md5_kwargs ).hexdigest ()
71
76
# Write the css file
72
77
css_path = static_path / f"design-style.{ hash } .min.css"
73
78
app .add_css_file (css_path .name )
You can’t perform that action at this time.
0 commit comments