From 126af66be3b1e212072fe89207e656bd93ff6d4a Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Tue, 23 Aug 2022 16:48:24 +0200 Subject: [PATCH] update doc/cmake.py - resolves import errors observed in sphinx 4.3.2 --- doc/cmake.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/cmake.py b/doc/cmake.py index 6075cf5a..2bdb01c9 100644 --- a/doc/cmake.py +++ b/doc/cmake.py @@ -2,6 +2,8 @@ # file Copyright.txt or https://cmake.org/licensing for details. # Team SMNG note: This file comes from here: https://github.com/Kitware/CMake/blob/master/Utilities/Sphinx/cmake.py +# Team SMNG note: applied patch from here: https://salsa.debian.org/science-team/ycm-cmake-modules/-/blob/master/debian/patches/fix-sphinx-build.patch +# On Ubuntu 22.04 LTS I needed to additionally install the following package: python3-sphinxcontrib.qthelp import os import re @@ -61,8 +63,12 @@ CMakeLexer.tokens["root"] = [ # Monkey patch for sphinx generating invalid content for qcollectiongenerator # https://bitbucket.org/birkenfeld/sphinx/issue/1435/qthelp-builder-should-htmlescape-keywords -from sphinx.util.pycompat import htmlescape -from sphinx.builders.qthelp import QtHelpBuilder +import html +try: + from sphinxcontrib.qthelp import QtHelpBuilder +except ImportError: + # sphinx < 4.0 + from sphinx.builders.qthelp import QtHelpBuilder old_build_keywords = QtHelpBuilder.build_keywords def new_build_keywords(self, title, refs, subitems): old_items = old_build_keywords(self, title, refs, subitems) @@ -71,7 +77,7 @@ def new_build_keywords(self, title, refs, subitems): before, rest = item.split("ref=\"", 1) ref, after = rest.split("\"") if ("<" in ref and ">" in ref): - new_items.append(before + "ref=\"" + htmlescape(ref) + "\"" + after) + new_items.append(before + "ref=\"" + html.escape(ref) + "\"" + after) else: new_items.append(item) return new_items -- GitLab