4
4
from pathlib import Path
5
5
from typing import Any ,Dict ,List
6
6
7
- import sphinx
8
7
import sphinx .application
9
8
from sphinx .builders .html import StandaloneHTMLBuilder
10
9
@@ -21,11 +20,6 @@ def _asset_hash(path: str) -> str:
21
20
22
21
23
22
def _add_asset_hashes (static :List [str ],add_digest_to :List [str ])-> None :
24
- if sphinx .version_info >= (7 ,1 ):
25
- # https://github.com/sphinx-doc/sphinx/pull/11415 added the relevant
26
- # functionality to Sphinx, so we don't need to do anything.
27
- return
28
-
29
23
for asset in add_digest_to :
30
24
index = static .index (asset )
31
25
static [index ].filename = _asset_hash (asset )# type: ignore
@@ -43,7 +37,7 @@ def _html_page_context(
43
37
44
38
assert isinstance (app .builder ,StandaloneHTMLBuilder )
45
39
46
- if sphinx .version_info >= ( 4 , )and "css_files" in context :
40
+ if ( 4 ,) <= sphinx .version_info < ( 7 , 1 )and "css_files" in context :
47
41
if "_static/pydoctheme.css" not in context ["css_files" ]:
48
42
raise ValueError (
49
43
"This documentation is not using `pydoctheme.css` as the stylesheet. "