From 1fab60e2b9c8e076e000e9ea715102103b343fc9 Mon Sep 17 00:00:00 2001 From: Darcy Mason Date: Sun, 3 Dec 2023 17:03:00 -0500 Subject: [PATCH] Backport fix for broken documentation search (#1969) --- doc/Makefile | 1 + doc/fix_search.py | 22 ++++++++++++++++++++++ doc/make.bat | 2 ++ pydicom/_version.py | 2 +- pyproject.toml | 2 +- 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 doc/fix_search.py diff --git a/doc/Makefile b/doc/Makefile index f75d5d7e29..2a61553a00 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -59,6 +59,7 @@ html: rm -rf $(BUILDDIR)/html/_images #rm -rf _build/doctrees/ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + python3 fix_search.py # TODO remove when sphinx_rtd_theme fixes upstream touch $(BUILDDIR)/html/.nojekyll @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." diff --git a/doc/fix_search.py b/doc/fix_search.py new file mode 100644 index 0000000000..a6cfc47c86 --- /dev/null +++ b/doc/fix_search.py @@ -0,0 +1,22 @@ +""" +A temporary fix for https://github.com/pydicom/pydicom/issues/1965 +while waiting for upstream sphinx_rtd_theme to fix/remove their +dependency on jQuery. +""" +from pathlib import Path +import re + + +search_html = Path("./_build/html/search.html") +assert search_html.exists() + +with open(search_html) as fp: + html = fp.read() + +pat = r"(' +# re.findall(pat, html) +html_fixed = re.sub(pat, repl, html) + +with open(search_html, "w") as fp: + fp.write(html_fixed) diff --git a/doc/make.bat b/doc/make.bat index ac2bd18dec..333497819e 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -35,6 +35,8 @@ if "%1" == "clean" ( if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + REM TODO remove when sphinx_rtd_theme fixes upstream + python fix_search.py echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end diff --git a/pydicom/_version.py b/pydicom/_version.py index e5a3a27fd1..cfe9663624 100644 --- a/pydicom/_version.py +++ b/pydicom/_version.py @@ -3,7 +3,7 @@ from typing import cast, Match -__version__: str = '2.4.2' +__version__: str = '2.4.4' result = cast(Match[str], re.match(r'(\d+\.\d+\.\d+).*', __version__)) __version_info__ = tuple(result.group(1).split('.')) diff --git a/pyproject.toml b/pyproject.toml index f8dc6ee8d4..ad6579d8ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ license = {text = "MIT"} name = "pydicom" readme = "README.md" requires-python = ">=3.7" -version = "2.4.3" +version = "2.4.4" [project.optional-dependencies]