]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-115198: Fix support of Docutils >= 0.19 in distutils (GH-115220)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 12 Feb 2024 11:45:22 +0000 (13:45 +0200)
committerGitHub <noreply@github.com>
Mon, 12 Feb 2024 11:45:22 +0000 (13:45 +0200)
Lib/distutils/command/check.py
Misc/NEWS.d/next/Library/2024-02-09-17-56-06.gh-issue-115198.QKrxUQ.rst [new file with mode: 0644]

index 73a30f3afd84a345bd2c15f48840b20584519c0f..0a5976676a817ded7f97ae312fea43b028733cec 100644 (file)
@@ -125,7 +125,13 @@ class check(Command):
         # the include and csv_table directives need this to be a path
         source_path = self.distribution.script_name or 'setup.py'
         parser = Parser()
-        settings = frontend.OptionParser(components=(Parser,)).get_default_values()
+        try:
+            get_default_settings = frontend.get_default_settings
+        except AttributeError:
+            # Deprecated in Docutils 0.19, may be broken in Docutils 0.21.
+            settings = frontend.OptionParser(components=(Parser,)).get_default_values()
+        else:
+            settings = get_default_settings(Parser)
         settings.tab_width = 4
         settings.pep_references = None
         settings.rfc_references = None
diff --git a/Misc/NEWS.d/next/Library/2024-02-09-17-56-06.gh-issue-115198.QKrxUQ.rst b/Misc/NEWS.d/next/Library/2024-02-09-17-56-06.gh-issue-115198.QKrxUQ.rst
new file mode 100644 (file)
index 0000000..78c10ae
--- /dev/null
@@ -0,0 +1 @@
+Fix support of Docutils >= 0.19 in :mod:`distutils`.