summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-11 14:09:01 +0000
committerKitware Robot <kwrobot@kitware.com>2022-10-11 10:09:11 -0400
commita804bf7007d319e0d7ed6d86c6d39b94a1b72984 (patch)
tree55a9025fd6dc33d08f70324b96f7a0ca8dd45584
parent65554ead15b92426be101b1ec0628872fa65838e (diff)
parent294b6db53345fa97913ae6b5df0208337cb6b4a6 (diff)
downloadcmake-a804bf7007d319e0d7ed6d86c6d39b94a1b72984.tar.gz
Merge topic 'docutils-error-helper-deprecation'
294b6db533 Utilities/Sphinx: Avoid deprecated docutils error handling helpers Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7777
-rw-r--r--Utilities/Sphinx/cmake.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index 9215e14986..c7b1233509 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -59,12 +59,6 @@ CMakeLexer.tokens["root"] = [
from docutils.parsers.rst import Directive, directives
from docutils.transforms import Transform
-try:
- from docutils.utils.error_reporting import SafeString, ErrorString
-except ImportError:
- # error_reporting was not in utils before version 0.11:
- from docutils.error_reporting import SafeString, ErrorString
-
from docutils import io, nodes
from sphinx.directives import ObjectDescription
@@ -130,13 +124,13 @@ class CMakeModule(Directive):
f = io.FileInput(source_path=path, encoding=encoding,
error_handler=e_handler)
except UnicodeEncodeError as error:
- raise self.severe('Problems with "%s" directive path:\n'
- 'Cannot encode input file path "%s" '
- '(wrong locale?).' %
- (self.name, SafeString(path)))
+ msg = ('Problems with "%s" directive path:\n'
+ 'Cannot encode input file path "%s" '
+ '(wrong locale?).' % (self.name, path))
+ raise self.severe(msg)
except IOError as error:
- raise self.severe('Problems with "%s" directive path:\n%s.' %
- (self.name, ErrorString(error)))
+ msg = 'Problems with "%s" directive path:\n%s.' % (self.name, error)
+ raise self.severe(msg)
raw_lines = f.read().splitlines()
f.close()
rst = None