forked from pool/python-Sphinx
Accepting request 1306500 from devel:languages:python
Fix the Staging:E with new python-docutils - Add upstream patch docutils022plus.patch to fix compatibility with docutils >= 0.22 gh#sphinx-doc/sphinx#13548 OBS-URL: https://build.opensuse.org/request/show/1306500 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Sphinx?expand=0&rev=113
This commit is contained in:
92
docutils022plus.patch
Normal file
92
docutils022plus.patch
Normal file
@@ -0,0 +1,92 @@
|
||||
From a81ce1a50bd478abb660624fc6ce621af9809cc1 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Turner <9087854+aa-turner@users.noreply.github.com>
|
||||
Date: Mon, 12 May 2025 21:36:47 +0100
|
||||
Subject: [PATCH] Fix ``test_util`` for Docutils 0.22+
|
||||
|
||||
---
|
||||
.../test_util_docutils_sphinx_directive.py | 35 +++++++++----------
|
||||
1 file changed, 17 insertions(+), 18 deletions(-)
|
||||
|
||||
Index: sphinx-8.2.3/tests/test_util/test_util_docutils_sphinx_directive.py
|
||||
===================================================================
|
||||
--- sphinx-8.2.3.orig/tests/test_util/test_util_docutils_sphinx_directive.py
|
||||
+++ sphinx-8.2.3/tests/test_util/test_util_docutils_sphinx_directive.py
|
||||
@@ -2,6 +2,8 @@ from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
|
||||
+import docutils
|
||||
+import pytest
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst.languages import en as english # type: ignore[attr-defined]
|
||||
from docutils.parsers.rst.states import (
|
||||
@@ -15,6 +17,12 @@ from docutils.statemachine import String
|
||||
from sphinx.util.docutils import SphinxDirective, new_document
|
||||
|
||||
|
||||
+xfail_du_22 = pytest.mark.xfail(
|
||||
+ docutils.__version_info__ >= (0, 22, 0, 'alpha', 0),
|
||||
+ reason='expected failure on Docutils 0.22+',
|
||||
+)
|
||||
+
|
||||
+
|
||||
def make_directive(
|
||||
*, env: SimpleNamespace, input_lines: StringList | None = None
|
||||
) -> SphinxDirective:
|
||||
@@ -30,23 +38,30 @@ def make_directive_and_state(
|
||||
if input_lines is not None:
|
||||
sm.input_lines = input_lines
|
||||
state = RSTState(sm)
|
||||
- state.document = new_document('<tests>')
|
||||
- state.document.settings.env = env
|
||||
- state.document.settings.tab_width = 4
|
||||
- state.document.settings.pep_references = None
|
||||
- state.document.settings.rfc_references = None
|
||||
+ document = state.document = new_document('<tests>')
|
||||
+ document.settings.env = env
|
||||
+ document.settings.tab_width = 4
|
||||
+ document.settings.pep_references = None
|
||||
+ document.settings.rfc_references = None
|
||||
inliner = Inliner()
|
||||
- inliner.init_customizations(state.document.settings)
|
||||
+ inliner.init_customizations(document.settings)
|
||||
state.inliner = inliner
|
||||
state.parent = None
|
||||
state.memo = SimpleNamespace(
|
||||
- document=state.document,
|
||||
+ document=document,
|
||||
+ reporter=document.reporter,
|
||||
language=english,
|
||||
- inliner=state.inliner,
|
||||
- reporter=state.document.reporter,
|
||||
- section_level=0,
|
||||
title_styles=[],
|
||||
+ # section_parents=[], # Docutils 0.22+
|
||||
+ section_level=0,
|
||||
+ section_bubble_up_kludge=False,
|
||||
+ inliner=inliner,
|
||||
)
|
||||
+ if docutils.__version_info__ >= (0, 22, 0, 'alpha', 0):
|
||||
+ # https://github.com/sphinx-doc/sphinx/issues/13539
|
||||
+ # https://sourceforge.net/p/docutils/code/10093/
|
||||
+ # https://sourceforge.net/p/docutils/patches/213/
|
||||
+ state.memo.section_parents = []
|
||||
directive = SphinxDirective(
|
||||
name='test_directive',
|
||||
arguments=[],
|
||||
@@ -104,6 +119,7 @@ def test_sphinx_directive_get_location()
|
||||
assert directive.get_location() == '<source>:1'
|
||||
|
||||
|
||||
+@xfail_du_22
|
||||
def test_sphinx_directive_parse_content_to_nodes() -> None:
|
||||
directive = make_directive(env=SimpleNamespace())
|
||||
content = 'spam\n====\n\nEggs! *Lobster thermidor.*'
|
||||
@@ -120,6 +136,7 @@ def test_sphinx_directive_parse_content_
|
||||
assert node.children[1].astext() == 'Eggs! Lobster thermidor.'
|
||||
|
||||
|
||||
+@xfail_du_22
|
||||
def test_sphinx_directive_parse_text_to_nodes() -> None:
|
||||
directive = make_directive(env=SimpleNamespace())
|
||||
content = 'spam\n====\n\nEggs! *Lobster thermidor.*'
|
||||
@@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 22 10:57:18 UTC 2025 - Daniel Garcia <daniel.garcia@suse.com>
|
||||
|
||||
- Add upstream patch docutils022plus.patch to fix compatibility with
|
||||
docutils >= 0.22
|
||||
gh#sphinx-doc/sphinx#13548
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 11 08:42:26 UTC 2025 - Markéta Machová <mmachova@suse.com>
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ Patch1: autosummary.patch
|
||||
Patch2: typing.patch
|
||||
# PATCH-FIX-UPSTREAM https://github.com/sphinx-doc/sphinx/commit/68d56109ff50dd81dd31d4a01e3dccbd006c50ee Tests: update LaTeX label test expectations from Docutils r10151
|
||||
Patch3: docutils022.patch
|
||||
# PATCH-FIX-UPSTREAM docutils022plus.patch https://github.com/sphinx-doc/sphinx/pull/13548
|
||||
Patch4: docutils022plus.patch
|
||||
BuildRequires: %{python_module base}
|
||||
BuildRequires: %{python_module flit-core >= 3.11}
|
||||
BuildRequires: %{python_module pip}
|
||||
|
||||
Reference in New Issue
Block a user