Skip to content

Commit

Permalink
Rework based on suggested changes
Browse files Browse the repository at this point in the history
Sphinx 7.1 added the relevant functionality natively.
  • Loading branch information
pradyunsg authored Jul 26, 2023
1 parent ef296e2 commit c7958da
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions python_docs_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from pathlib import Path
from typing import Any, Dict, List

import sphinx
import sphinx.application
from sphinx.builders.html import StandaloneHTMLBuilder

Expand All @@ -21,11 +20,6 @@ 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(asset)
static[index].filename = _asset_hash(asset) # type: ignore
Expand All @@ -43,7 +37,7 @@ def _html_page_context(

assert isinstance(app.builder, StandaloneHTMLBuilder)

if sphinx.version_info >= (4,) and "css_files" in context:
if (4,) <= sphinx.version_info < (7, 1) and "css_files" in context:
if "_static/pydoctheme.css" not in context["css_files"]:
raise ValueError(
"This documentation is not using `pydoctheme.css` as the stylesheet. "
Expand Down

0 comments on commit c7958da

Please sign in to comment.