From a01fbaeba4bdefc2ff6782bac73a9a03b8a9bce7 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 11 Aug 2023 01:48:00 +0100 Subject: [PATCH] Disable ``add_html_cache_busting`` on Sphinx 7.1+ --- doc/conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 65781e694958..66b367c9e267 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -19,6 +19,8 @@ import sys from urllib.parse import urlsplit, urlunsplit import warnings + +import sphinx import yaml import matplotlib @@ -408,6 +410,9 @@ def add_html_cache_busting(app, pagename, templatename, context, doctree): This adds the Matplotlib version as a query to the link reference in the HTML, if the path is not absolute (i.e., it comes from the `_static` directory) and doesn't already have a query. + + .. note:: Sphinx 7.1 provides asset checksums; so this hook only runs on + Sphinx 7.0 and earlier. """ from sphinx.builders.html import Stylesheet, JavaScript @@ -785,4 +790,5 @@ def setup(app): bld_type = 'rel' app.add_config_value('skip_sub_dirs', 0, '') app.add_config_value('releaselevel', bld_type, 'env') - app.connect('html-page-context', add_html_cache_busting, priority=1000) + if sphinx.version_info[:2] < (7, 1): + app.connect('html-page-context', add_html_cache_busting, priority=1000)