From a92dd0c2bfa398825e239171925a81bdc428e90a Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Wed, 26 Jul 2023 19:44:09 +0100 Subject: [PATCH] Make `_add_asset_hashes` a no-op with Sphinx 7.1 This makes things work properly with the newest version of Sphinx, which added new functionality. --- src/furo/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/furo/__init__.py b/src/furo/__init__.py index 97a7cfbc..f7ad5a8d 100644 --- a/src/furo/__init__.py +++ b/src/furo/__init__.py @@ -156,6 +156,11 @@ def _asset_hash(path: str) -> str: def _add_asset_hashes(static: List[str], add_digest_to: List[str]) -> None: + if sphinx.version_info >= (7, 1): + # https://github.com/sphinx-doc/sphinx/pull/11415 added the relevant + # functionality to Sphinx, so we don't need to do anything. + return + for asset in add_digest_to: index = static.index("_static/" + asset) static[index].filename = _asset_hash(asset) # type: ignore