forked from pool/python312
Adjust patch
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python312?expand=0&rev=100
This commit is contained in:
@@ -1,25 +1,34 @@
|
|||||||
---
|
---
|
||||||
Doc/conf.py | 8 ++--
|
Doc/conf.py | 16 ++++++++-
|
||||||
Doc/tools/check-warnings.py | 3 +
|
Doc/tools/check-warnings.py | 3 +
|
||||||
Doc/tools/extensions/audit_events.py | 54 ++++++++++++++++----------------
|
Doc/tools/extensions/audit_events.py | 54 ++++++++++++++++----------------
|
||||||
Doc/tools/extensions/availability.py | 15 ++++----
|
Doc/tools/extensions/availability.py | 15 ++++----
|
||||||
Doc/tools/extensions/c_annotations.py | 37 ++++++++++-----------
|
Doc/tools/extensions/c_annotations.py | 45 ++++++++++++++++----------
|
||||||
Doc/tools/extensions/glossary_search.py | 10 +----
|
Doc/tools/extensions/glossary_search.py | 10 +----
|
||||||
Doc/tools/extensions/patchlevel.py | 9 ++---
|
Doc/tools/extensions/patchlevel.py | 9 ++---
|
||||||
7 files changed, 67 insertions(+), 69 deletions(-)
|
7 files changed, 86 insertions(+), 66 deletions(-)
|
||||||
|
|
||||||
--- a/Doc/conf.py
|
--- a/Doc/conf.py
|
||||||
+++ b/Doc/conf.py
|
+++ b/Doc/conf.py
|
||||||
@@ -85,7 +85,7 @@ today_fmt = '%B %d, %Y'
|
@@ -10,6 +10,8 @@ import importlib
|
||||||
highlight_language = 'python3'
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
+from sphinx import version_info
|
||||||
|
+
|
||||||
|
# Make our custom extensions available to Sphinx
|
||||||
|
sys.path.append(os.path.abspath('tools/extensions'))
|
||||||
|
sys.path.append(os.path.abspath('includes'))
|
||||||
|
@@ -82,7 +84,7 @@ highlight_language = 'python3'
|
||||||
|
|
||||||
# Minimum version of sphinx required
|
# Minimum version of sphinx required
|
||||||
-needs_sphinx = '7.2.6'
|
# Keep this version in sync with ``Doc/requirements.txt``.
|
||||||
|
-needs_sphinx = '8.1.3'
|
||||||
+needs_sphinx = '4.2.0'
|
+needs_sphinx = '4.2.0'
|
||||||
|
|
||||||
# Create table of contents entries for domain objects (e.g. functions, classes,
|
# Create table of contents entries for domain objects (e.g. functions, classes,
|
||||||
# attributes, etc.). Default is True.
|
# attributes, etc.). Default is True.
|
||||||
@@ -342,7 +342,7 @@ html_short_title = f'{release} Documenta
|
@@ -337,7 +339,7 @@ html_short_title = f'{release} Documenta
|
||||||
# (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
|
# (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
|
||||||
is_deployment_preview = os.getenv("READTHEDOCS_VERSION_TYPE") == "external"
|
is_deployment_preview = os.getenv("READTHEDOCS_VERSION_TYPE") == "external"
|
||||||
repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL", "")
|
repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL", "")
|
||||||
@@ -28,22 +37,23 @@
|
|||||||
html_context = {
|
html_context = {
|
||||||
"is_deployment_preview": is_deployment_preview,
|
"is_deployment_preview": is_deployment_preview,
|
||||||
"repository_url": repository_url or None,
|
"repository_url": repository_url or None,
|
||||||
@@ -598,13 +598,13 @@ extlinks_detect_hardcoded_links = True
|
@@ -583,6 +585,16 @@ extlinks = {
|
||||||
|
}
|
||||||
if sphinx.version_info[:2] < (8, 1):
|
extlinks_detect_hardcoded_links = True
|
||||||
# Sphinx 8.1 has in-built CVE and CWE roles.
|
|
||||||
- extlinks |= {
|
|
||||||
+ extlinks.update({
|
|
||||||
"cve": (
|
|
||||||
"https://www.cve.org/CVERecord?id=CVE-%s",
|
|
||||||
"CVE-%s",
|
|
||||||
),
|
|
||||||
"cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"),
|
|
||||||
- }
|
|
||||||
+ })
|
|
||||||
|
|
||||||
|
+if version_info[:2] < (8, 1):
|
||||||
|
+ # Sphinx 8.1 has in-built CVE and CWE roles.
|
||||||
|
+ extlinks.update({
|
||||||
|
+ "cve": (
|
||||||
|
+ "https://www.cve.org/CVERecord?id=CVE-%s",
|
||||||
|
+ "CVE-%s",
|
||||||
|
+ ),
|
||||||
|
+ "cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"),
|
||||||
|
+ })
|
||||||
|
+
|
||||||
# Options for c_annotations extension
|
# Options for c_annotations extension
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
|
|
||||||
--- a/Doc/tools/check-warnings.py
|
--- a/Doc/tools/check-warnings.py
|
||||||
+++ b/Doc/tools/check-warnings.py
|
+++ b/Doc/tools/check-warnings.py
|
||||||
@@ -228,7 +228,8 @@ def fail_if_regression(
|
@@ -228,7 +228,8 @@ def fail_if_regression(
|
||||||
@@ -210,16 +220,16 @@
|
|||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
@@ -52,7 +50,7 @@ class Availability(SphinxDirective):
|
@@ -53,7 +51,7 @@ class Availability(SphinxDirective):
|
||||||
optional_arguments = 0
|
optional_arguments = 0
|
||||||
final_argument_whitespace = True
|
final_argument_whitespace = True
|
||||||
|
|
||||||
- def run(self) -> list[nodes.container]:
|
- def run(self) -> list[nodes.container]:
|
||||||
+ def run(self) -> List[nodes.container]:
|
+ def run(self) -> List[nodes.container]:
|
||||||
title = "Availability"
|
title = sphinx_gettext("Availability")
|
||||||
refnode = addnodes.pending_xref(
|
refnode = addnodes.pending_xref(
|
||||||
title,
|
title,
|
||||||
@@ -76,7 +74,7 @@ class Availability(SphinxDirective):
|
@@ -77,7 +75,7 @@ class Availability(SphinxDirective):
|
||||||
|
|
||||||
return [cnode]
|
return [cnode]
|
||||||
|
|
||||||
@@ -228,7 +238,7 @@
|
|||||||
"""Parse platform information from arguments
|
"""Parse platform information from arguments
|
||||||
|
|
||||||
Arguments is a comma-separated string of platforms. A platform may
|
Arguments is a comma-separated string of platforms. A platform may
|
||||||
@@ -95,12 +93,13 @@ class Availability(SphinxDirective):
|
@@ -96,12 +94,13 @@ class Availability(SphinxDirective):
|
||||||
platform, _, version = arg.partition(" >= ")
|
platform, _, version = arg.partition(" >= ")
|
||||||
if platform.startswith("not "):
|
if platform.startswith("not "):
|
||||||
version = False
|
version = False
|
||||||
@@ -244,7 +254,7 @@
|
|||||||
logger.warning(
|
logger.warning(
|
||||||
"Unknown platform%s or syntax '%s' in '.. availability:: %s', "
|
"Unknown platform%s or syntax '%s' in '.. availability:: %s', "
|
||||||
"see %s:KNOWN_PLATFORMS for a set of known platforms.",
|
"see %s:KNOWN_PLATFORMS for a set of known platforms.",
|
||||||
@@ -113,7 +112,7 @@ class Availability(SphinxDirective):
|
@@ -114,7 +113,7 @@ class Availability(SphinxDirective):
|
||||||
return platforms
|
return platforms
|
||||||
|
|
||||||
|
|
||||||
@@ -255,7 +265,7 @@
|
|||||||
return {
|
return {
|
||||||
--- a/Doc/tools/extensions/c_annotations.py
|
--- a/Doc/tools/extensions/c_annotations.py
|
||||||
+++ b/Doc/tools/extensions/c_annotations.py
|
+++ b/Doc/tools/extensions/c_annotations.py
|
||||||
@@ -9,12 +9,10 @@ Configuration:
|
@@ -9,22 +9,18 @@ Configuration:
|
||||||
* Set ``stable_abi_file`` to the path to stable ABI list.
|
* Set ``stable_abi_file`` to the path to stable ABI list.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -267,9 +277,10 @@
|
|||||||
-from typing import TYPE_CHECKING
|
-from typing import TYPE_CHECKING
|
||||||
+from typing import Any, Dict, List, TYPE_CHECKING, Union
|
+from typing import Any, Dict, List, TYPE_CHECKING, Union
|
||||||
|
|
||||||
import sphinx
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
@@ -23,9 +21,7 @@ from sphinx import addnodes
|
from docutils.statemachine import StringList
|
||||||
|
-from sphinx import addnodes
|
||||||
|
+from sphinx import addnodes, version_info
|
||||||
from sphinx.locale import _ as sphinx_gettext
|
from sphinx.locale import _ as sphinx_gettext
|
||||||
from sphinx.util.docutils import SphinxDirective
|
from sphinx.util.docutils import SphinxDirective
|
||||||
|
|
||||||
@@ -280,7 +291,7 @@
|
|||||||
|
|
||||||
ROLE_TO_OBJECT_TYPE = {
|
ROLE_TO_OBJECT_TYPE = {
|
||||||
"func": "function",
|
"func": "function",
|
||||||
@@ -36,20 +32,20 @@ ROLE_TO_OBJECT_TYPE = {
|
@@ -35,20 +31,20 @@ ROLE_TO_OBJECT_TYPE = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -305,7 +316,7 @@
|
|||||||
class StableABIEntry:
|
class StableABIEntry:
|
||||||
# Role of the object.
|
# Role of the object.
|
||||||
# Source: Each [item_kind] in stable_abi.toml is mapped to a C Domain role.
|
# Source: Each [item_kind] in stable_abi.toml is mapped to a C Domain role.
|
||||||
@@ -68,7 +64,7 @@ class StableABIEntry:
|
@@ -67,7 +63,7 @@ class StableABIEntry:
|
||||||
struct_abi_kind: str
|
struct_abi_kind: str
|
||||||
|
|
||||||
|
|
||||||
@@ -314,7 +325,7 @@
|
|||||||
refcount_data = {}
|
refcount_data = {}
|
||||||
refcounts = refcount_filename.read_text(encoding="utf8")
|
refcounts = refcount_filename.read_text(encoding="utf8")
|
||||||
for line in refcounts.splitlines():
|
for line in refcounts.splitlines():
|
||||||
@@ -104,7 +100,7 @@ def read_refcount_data(refcount_filename
|
@@ -103,7 +99,7 @@ def read_refcount_data(refcount_filename
|
||||||
return refcount_data
|
return refcount_data
|
||||||
|
|
||||||
|
|
||||||
@@ -323,7 +334,7 @@
|
|||||||
stable_abi_data = {}
|
stable_abi_data = {}
|
||||||
with open(stable_abi_file, encoding="utf8") as fp:
|
with open(stable_abi_file, encoding="utf8") as fp:
|
||||||
for record in csv.DictReader(fp):
|
for record in csv.DictReader(fp):
|
||||||
@@ -128,11 +124,14 @@ def add_annotations(app: Sphinx, doctree
|
@@ -127,11 +123,14 @@ def add_annotations(app: Sphinx, doctree
|
||||||
continue
|
continue
|
||||||
if not par[0].get("ids", None):
|
if not par[0].get("ids", None):
|
||||||
continue
|
continue
|
||||||
@@ -340,7 +351,7 @@
|
|||||||
if ROLE_TO_OBJECT_TYPE[record.role] != objtype:
|
if ROLE_TO_OBJECT_TYPE[record.role] != objtype:
|
||||||
msg = (
|
msg = (
|
||||||
f"Object type mismatch in limited API annotation for {name}: "
|
f"Object type mismatch in limited API annotation for {name}: "
|
||||||
@@ -239,7 +238,7 @@ def _unstable_api_annotation() -> nodes.
|
@@ -238,7 +237,7 @@ def _unstable_api_annotation() -> nodes.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -349,7 +360,7 @@
|
|||||||
classes = ["refcount"]
|
classes = ["refcount"]
|
||||||
if result_refs is None:
|
if result_refs is None:
|
||||||
rc = sphinx_gettext("Return value: Always NULL.")
|
rc = sphinx_gettext("Return value: Always NULL.")
|
||||||
@@ -259,7 +258,7 @@ class LimitedAPIList(SphinxDirective):
|
@@ -258,7 +257,7 @@ class LimitedAPIList(SphinxDirective):
|
||||||
optional_arguments = 0
|
optional_arguments = 0
|
||||||
final_argument_whitespace = True
|
final_argument_whitespace = True
|
||||||
|
|
||||||
@@ -358,7 +369,7 @@
|
|||||||
state = self.env.domaindata["c_annotations"]
|
state = self.env.domaindata["c_annotations"]
|
||||||
content = [
|
content = [
|
||||||
f"* :c:{record.role}:`{record.name}`"
|
f"* :c:{record.role}:`{record.name}`"
|
||||||
@@ -282,7 +281,7 @@ def init_annotations(app: Sphinx) -> Non
|
@@ -281,13 +280,23 @@ def init_annotations(app: Sphinx) -> Non
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -367,19 +378,22 @@
|
|||||||
app.add_config_value("refcount_file", "", "env", types={str})
|
app.add_config_value("refcount_file", "", "env", types={str})
|
||||||
app.add_config_value("stable_abi_file", "", "env", types={str})
|
app.add_config_value("stable_abi_file", "", "env", types={str})
|
||||||
app.add_directive("limited-api-list", LimitedAPIList)
|
app.add_directive("limited-api-list", LimitedAPIList)
|
||||||
@@ -294,10 +293,10 @@ def setup(app: Sphinx) -> ExtensionMetad
|
app.connect("builder-inited", init_annotations)
|
||||||
from sphinx.domains.c import CObject
|
app.connect("doctree-read", add_annotations)
|
||||||
|
|
||||||
# monkey-patch C object...
|
+ if version_info[:2] < (7, 2):
|
||||||
- CObject.option_spec |= {
|
+ from docutils.parsers.rst import directives
|
||||||
|
+ from sphinx.domains.c import CObject
|
||||||
|
+
|
||||||
|
+ # monkey-patch C object...
|
||||||
+ CObject.option_spec.update({
|
+ CObject.option_spec.update({
|
||||||
"no-index-entry": directives.flag,
|
+ "no-index-entry": directives.flag,
|
||||||
"no-contents-entry": directives.flag,
|
+ "no-contents-entry": directives.flag,
|
||||||
- }
|
|
||||||
+ })
|
+ })
|
||||||
|
+
|
||||||
return {
|
return {
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
|
"parallel_read_safe": True,
|
||||||
--- a/Doc/tools/extensions/glossary_search.py
|
--- a/Doc/tools/extensions/glossary_search.py
|
||||||
+++ b/Doc/tools/extensions/glossary_search.py
|
+++ b/Doc/tools/extensions/glossary_search.py
|
||||||
@@ -1,18 +1,14 @@
|
@@ -1,18 +1,14 @@
|
||||||
|
|||||||
Reference in New Issue
Block a user