From 32717178fc20b3be2476d534ca0b020c9c7fe3d9375f9fdde2f225de30f8cadb Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 6 Feb 2025 18:39:10 +0000 Subject: [PATCH] Update documentation patch. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python312?expand=0&rev=102 --- doc-py38-to-py36.patch | 129 ++++++++++++++++++++++++++++++++++++++++- python312.spec | 2 +- 2 files changed, 128 insertions(+), 3 deletions(-) diff --git a/doc-py38-to-py36.patch b/doc-py38-to-py36.patch index cb9efe5..b3ba20f 100644 --- a/doc-py38-to-py36.patch +++ b/doc-py38-to-py36.patch @@ -1,13 +1,38 @@ --- + Doc/Makefile | 8 ++-- Doc/conf.py | 16 ++++++++- - Doc/tools/check-warnings.py | 3 + + Doc/tools/check-warnings.py | 5 +- Doc/tools/extensions/audit_events.py | 54 ++++++++++++++++---------------- Doc/tools/extensions/availability.py | 15 ++++---- Doc/tools/extensions/c_annotations.py | 45 ++++++++++++++++---------- + Doc/tools/extensions/changes.py | 8 +--- Doc/tools/extensions/glossary_search.py | 10 +---- + Doc/tools/extensions/misc_news.py | 14 +++----- Doc/tools/extensions/patchlevel.py | 9 ++--- - 7 files changed, 86 insertions(+), 66 deletions(-) + 10 files changed, 100 insertions(+), 84 deletions(-) +--- a/Doc/Makefile ++++ b/Doc/Makefile +@@ -14,15 +14,15 @@ PAPER = + SOURCES = + DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) + REQUIREMENTS = requirements.txt +-SPHINXERRORHANDLING = --fail-on-warning ++SPHINXERRORHANDLING = -W + + # Internal variables. + PAPEROPT_a4 = --define latex_elements.papersize=a4paper + PAPEROPT_letter = --define latex_elements.papersize=letterpaper + +-ALLSPHINXOPTS = --builder $(BUILDER) \ +- --doctree-dir build/doctrees \ +- --jobs $(JOBS) \ ++ALLSPHINXOPTS = -b $(BUILDER) \ ++ -d build/doctrees \ ++ -j $(JOBS) \ + $(PAPEROPT_$(PAPER)) \ + $(SPHINXOPTS) $(SPHINXERRORHANDLING) \ + . build/$(BUILDER) $(SOURCES) --- a/Doc/conf.py +++ b/Doc/conf.py @@ -10,6 +10,8 @@ import importlib @@ -66,6 +91,15 @@ print(" {line}: {msg}".format_map(match)) return -1 return 0 +@@ -316,7 +317,7 @@ def main(argv: list[str] | None = None) + + cwd = str(Path.cwd()) + os.path.sep + files_with_nits = { +- warning.removeprefix(cwd).split(":")[0] ++ (warning[len(cwd):].split(":")[0] if warning.startswith(cwd) else warning.split(":")[0]) + for warning in warnings + if "Doc/" in warning + } --- a/Doc/tools/extensions/audit_events.py +++ b/Doc/tools/extensions/audit_events.py @@ -1,9 +1,6 @@ @@ -394,6 +428,43 @@ return { "version": "1.0", "parallel_read_safe": True, +--- a/Doc/tools/extensions/changes.py ++++ b/Doc/tools/extensions/changes.py +@@ -1,7 +1,5 @@ + """Support for documenting version of changes, additions, deprecations.""" + +-from __future__ import annotations +- + from typing import TYPE_CHECKING + + from sphinx.domains.changeset import ( +@@ -25,7 +23,7 @@ def expand_version_arg(argument: str, re + + + class PyVersionChange(VersionChange): +- def run(self) -> list[Node]: ++ def run(self) -> "list[Node]": + # Replace the 'next' special token with the current development version + self.arguments[0] = expand_version_arg( + self.arguments[0], self.config.release +@@ -43,7 +41,7 @@ class DeprecatedRemoved(VersionChange): + "Deprecated since version %s, removed in version %s" + ) + +- def run(self) -> list[Node]: ++ def run(self) -> "list[Node]": + # Replace the first two arguments (deprecated version and removed version) + # with a single tuple of both versions. + version_deprecated = expand_version_arg( +@@ -73,7 +71,7 @@ class DeprecatedRemoved(VersionChange): + versionlabel_classes[self.name] = "" + + +-def setup(app: Sphinx) -> ExtensionMetadata: ++def setup(app: "Sphinx") -> "ExtensionMetadata": + # Override Sphinx's directives with support for 'next' + app.add_directive("versionadded", PyVersionChange, override=True) + app.add_directive("versionchanged", PyVersionChange, override=True) --- a/Doc/tools/extensions/glossary_search.py +++ b/Doc/tools/extensions/glossary_search.py @@ -1,18 +1,14 @@ @@ -426,6 +497,60 @@ app.connect('doctree-resolved', process_glossary_nodes) app.connect('build-finished', write_glossary_json) +--- a/Doc/tools/extensions/misc_news.py ++++ b/Doc/tools/extensions/misc_news.py +@@ -1,7 +1,5 @@ + """Support for including Misc/NEWS.""" + +-from __future__ import annotations +- + import re + from pathlib import Path + from typing import TYPE_CHECKING +@@ -24,13 +22,13 @@ Python News + +++++++++++ + """ + +-bpo_issue_re: Final[re.Pattern[str]] = re.compile( ++bpo_issue_re: "Final[re.Pattern[str]]" = re.compile( + "(?:issue #|bpo-)([0-9]+)", re.ASCII + ) +-gh_issue_re: Final[re.Pattern[str]] = re.compile( ++gh_issue_re: "Final[re.Pattern[str]]" = re.compile( + "gh-(?:issue-)?([0-9]+)", re.ASCII | re.IGNORECASE + ) +-whatsnew_re: Final[re.Pattern[str]] = re.compile( ++whatsnew_re: "Final[re.Pattern[str]]" = re.compile( + r"^what's new in (.*?)\??$", re.ASCII | re.IGNORECASE | re.MULTILINE + ) + +@@ -42,7 +40,7 @@ class MiscNews(SphinxDirective): + final_argument_whitespace = False + option_spec = {} + +- def run(self) -> list[Node]: ++ def run(self) -> "list[Node]": + # Get content of NEWS file + source, _ = self.get_source_info() + news_file = Path(source).resolve().parent / self.arguments[0] +@@ -54,7 +52,7 @@ class MiscNews(SphinxDirective): + return [nodes.strong(text, text)] + + # remove first 3 lines as they are the main heading +- news_text = news_text.removeprefix(BLURB_HEADER) ++ news_text = news_text[len(BLURB_HEADER):] if news_text.startswith(BLURB_HEADER) else news_text + + news_text = bpo_issue_re.sub(r":issue:`\1`", news_text) + # Fallback handling for GitHub issues +@@ -65,7 +63,7 @@ class MiscNews(SphinxDirective): + return [] + + +-def setup(app: Sphinx) -> ExtensionMetadata: ++def setup(app: "Sphinx") -> "ExtensionMetadata": + app.add_directive("miscnews", MiscNews) + + return { --- a/Doc/tools/extensions/patchlevel.py +++ b/Doc/tools/extensions/patchlevel.py @@ -3,7 +3,7 @@ diff --git a/python312.spec b/python312.spec index 9610317..e793bc9 100644 --- a/python312.spec +++ b/python312.spec @@ -755,7 +755,7 @@ rm %{buildroot}%{_bindir}/2to3 # documentation export PDOCS=%{buildroot}%{_docdir}/%{name} install -d -m 755 $PDOCS -install -c -m 644 %{SOURCE3} $PDOCS/ +install -c -m 644 %{SOURCE4} $PDOCS/ install -c -m 644 README.rst $PDOCS/ # tools