9 Commits

Author SHA256 Message Date
54495e5482 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
2025-09-23 14:06:34 +00:00
262ff4da7a - Add upstream patch docutils022plus.patch to fix compatibility with
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Sphinx?expand=0&rev=291
2025-09-22 11:54:35 +00:00
0751fc4d04 - Add upstream patch docutils022plush.patch to fix compatibility with
docutils >= 0.22
  gh#sphinx-doc/sphinx#13548

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Sphinx?expand=0&rev=290
2025-09-22 11:26:01 +00:00
b19876e289 Accepting request 1304238 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1304238
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Sphinx?expand=0&rev=112
2025-09-12 19:09:22 +00:00
053ce84ac8 - Add upstream patches to fix tests with Python 3.14:
* autodoc.patch
  * autosummary.patch
  * typing.patch
- Proactively add upstream patch to fix tests with docutils 0.22:
  * docutils022.patch
- Rename multibuild flavor 'test' to 'test+doc' to better reflect
  the current behaviour

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Sphinx?expand=0&rev=288
2025-09-12 08:04:55 +00:00
5ed97d8cd3 Accepting request 1301462 from devel:languages:python
- Convert to libalternatives on SLE-16-based and newer systems

OBS-URL: https://build.opensuse.org/request/show/1301462
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Sphinx?expand=0&rev=111
2025-08-27 19:33:37 +00:00
ab8e5550b1 fix with kernel script
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Sphinx?expand=0&rev=286
2025-08-26 15:41:06 +00:00
c06dc2df8a fix macro name
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Sphinx?expand=0&rev=285
2025-08-25 13:31:12 +00:00
b07cb14a8f - Convert to libalternatives on SLE-16-based and newer systems
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Sphinx?expand=0&rev=284
2025-08-25 13:07:55 +00:00
8 changed files with 302 additions and 10 deletions

View File

@@ -1,3 +1,3 @@
<multibuild>
<package>test</package>
<package>test+doc</package>
</multibuild>

33
autodoc.patch Normal file
View File

@@ -0,0 +1,33 @@
From 0227606e71dc765ed60cd0ad2c580a43b5ffca4f Mon Sep 17 00:00:00 2001
From: James Addison <55152140+jayaddison@users.noreply.github.com>
Date: Mon, 12 May 2025 16:52:52 +0000
Subject: [PATCH] Fix tests for Python 3.14.0a7 (#13527)
Authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: James Addison <55152140+jayaddison@users.noreply.github.com>
---
tests/test_extensions/test_ext_autodoc.py | 6 +++++-
tests/test_extensions/test_ext_autodoc_configs.py | 12 ++++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/tests/test_extensions/test_ext_autodoc.py b/tests/test_extensions/test_ext_autodoc.py
index a06c1bbe30d..7aa12db3c32 100644
--- a/tests/test_extensions/test_ext_autodoc.py
+++ b/tests/test_extensions/test_ext_autodoc.py
@@ -938,10 +938,14 @@ def test_autodoc_special_members(app):
}
if sys.version_info >= (3, 13, 0, 'alpha', 5):
options['exclude-members'] = '__static_attributes__,__firstlineno__'
+ if sys.version_info >= (3, 14, 0, 'alpha', 7):
+ ann_attr_name = '__annotations_cache__'
+ else:
+ ann_attr_name = '__annotations__'
actual = do_autodoc(app, 'class', 'target.Class', options)
assert list(filter(lambda l: '::' in l, actual)) == [
'.. py:class:: Class(arg)',
- ' .. py:attribute:: Class.__annotations__',
+ f' .. py:attribute:: Class.{ann_attr_name}',
' .. py:attribute:: Class.__dict__',
' .. py:method:: Class.__init__(arg)',
' .. py:attribute:: Class.__module__',

29
autosummary.patch Normal file
View File

@@ -0,0 +1,29 @@
From 8962398b761c3d85a7c74b6f789b3ffb127bde0c Mon Sep 17 00:00:00 2001
From: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Date: Thu, 6 Mar 2025 16:03:44 +0000
Subject: [PATCH] autosummary: Update test for Python 3.14.0a5+ (#13418)
`types.UnionType` and `typing.Union` have been merged.
---
tests/test_extensions/test_ext_autosummary.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/test_extensions/test_ext_autosummary.py b/tests/test_extensions/test_ext_autosummary.py
index 35dc7d180ef..c807ddba3d1 100644
--- a/tests/test_extensions/test_ext_autosummary.py
+++ b/tests/test_extensions/test_ext_autosummary.py
@@ -447,8 +447,12 @@ def test_autosummary_generate_content_for_module_imported_members(app):
]
assert context['functions'] == ['bar']
assert context['all_functions'] == ['_quux', 'bar']
- assert context['classes'] == ['Class', 'Foo']
- assert context['all_classes'] == ['Class', 'Foo', '_Baz']
+ if sys.version_info >= (3, 14, 0, 'alpha', 5):
+ assert context['classes'] == ['Class', 'Foo', 'Union']
+ assert context['all_classes'] == ['Class', 'Foo', 'Union', '_Baz']
+ else:
+ assert context['classes'] == ['Class', 'Foo']
+ assert context['all_classes'] == ['Class', 'Foo', '_Baz']
assert context['exceptions'] == ['Exc']
assert context['all_exceptions'] == ['Exc', '_Exc']
assert context['attributes'] == ['CONSTANT1', 'qux', 'quuz', 'non_imported_member']

50
docutils022.patch Normal file
View File

@@ -0,0 +1,50 @@
From 68d56109ff50dd81dd31d4a01e3dccbd006c50ee Mon Sep 17 00:00:00 2001
From: James Addison <55152140+jayaddison@users.noreply.github.com>
Date: Mon, 2 Jun 2025 22:02:48 +0000
Subject: [PATCH] Tests: update LaTeX label test expectations from Docutils
r10151 (#13610)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
---
tests/test_builders/test_build_latex.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tests/test_builders/test_build_latex.py b/tests/test_builders/test_build_latex.py
index 0d1c607462d..37e708a021e 100644
--- a/tests/test_builders/test_build_latex.py
+++ b/tests/test_builders/test_build_latex.py
@@ -12,6 +12,7 @@
from subprocess import CalledProcessError
from typing import TYPE_CHECKING
+import docutils
import pygments
import pytest
@@ -1959,10 +1960,16 @@ def test_latex_labels(app: SphinxTestApp) -> None:
result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
+ # ref: docutils r10151
+ if docutils.__version_info__[:2] < (0, 22):
+ figure_id, table_id = 'id1', 'id2'
+ else:
+ figure_id, table_id = 'id2', 'id3'
+
# figures
assert (
r'\caption{labeled figure}'
- r'\label{\detokenize{index:id1}}'
+ r'\label{\detokenize{index:' + figure_id + '}}'
r'\label{\detokenize{index:figure2}}'
r'\label{\detokenize{index:figure1}}'
r'\end{figure}'
@@ -1988,7 +1995,7 @@ def test_latex_labels(app: SphinxTestApp) -> None:
# tables
assert (
r'\sphinxcaption{table caption}'
- r'\label{\detokenize{index:id2}}'
+ r'\label{\detokenize{index:' + table_id + '}}'
r'\label{\detokenize{index:table2}}'
r'\label{\detokenize{index:table1}}'
) in result

92
docutils022plus.patch Normal file
View 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.*'

View File

@@ -1,3 +1,27 @@
-------------------------------------------------------------------
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>
- Add upstream patches to fix tests with Python 3.14:
* autodoc.patch
* autosummary.patch
* typing.patch
- Proactively add upstream patch to fix tests with docutils 0.22:
* docutils022.patch
- Rename multibuild flavor 'test' to 'test+doc' to better reflect
the current behaviour
-------------------------------------------------------------------
Mon Aug 25 12:56:50 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to libalternatives on SLE-16-based and newer systems
-------------------------------------------------------------------
Fri Mar 14 12:12:22 UTC 2025 - Markéta Machová <mmachova@suse.com>
@@ -3804,7 +3828,6 @@ Release 1.3.3 (released Dec 2, 2015)
====================================
Bugs fixed
----------
* #2012: Fix exception occurred if ``numfig_format`` is invalid
* #2142: Provide non-minified JS code in ``sphinx/search/non-minified-js/*.js`` for
@@ -3816,12 +3839,10 @@ Release 1.3.2 (released Nov 29, 2015)
=====================================
Features added
--------------
* #1935: Make "numfig_format" overridable in latex_elements.
Bugs fixed
----------
* #1976: Avoid "2.0" version of Babel because it doesn't work with Windows environment.
* Add a "default.css" stylesheet (which imports "classic.css") for compatibility.

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-Sphinx
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,13 +17,18 @@
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%if "%{flavor}" == "test+doc"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?sle15_python_module_pythons}
Name: python-Sphinx%{psuffix}
Version: 8.2.3
@@ -42,6 +47,16 @@ Source3: requests.inv
Source4: readthedocs.inv
Source5: update-intersphinx.sh
Source99: python-Sphinx.keyring
# PATCH-FIX-UPSTREAM https://github.com/sphinx-doc/sphinx/pull/13527 Followup-to: Fix tests for Python 3.14a7+
Patch0: autodoc.patch
# PATCH-FIX-UPSTREAM https://github.com/sphinx-doc/sphinx/commit/8962398b761c3d85a7c74b6f789b3ffb127bde0c autosummary: Update test for Python 3.14.0a5+
Patch1: autosummary.patch
# PATCH-FIX-UPSTREAM https://github.com/sphinx-doc/sphinx/commit/e01e42f5fc738815b8499c4ede30c6caf130f0a4 Fix INVALID_BUILTIN_CLASSES test for Python 3.14.0a6+
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}
@@ -68,13 +83,18 @@ Requires: python-sphinxcontrib-htmlhelp >= 2.0.0
Requires: python-sphinxcontrib-jsmath
Requires: python-sphinxcontrib-qthelp >= 1.0.2
Requires: python-sphinxcontrib-serializinghtml >= 1.1.9
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends: python-SQLAlchemy >= 0.9
Recommends: python-Sphinx-doc-man
Recommends: python-Whoosh >= 2.0
Suggests: python-sphinx_rtd_theme
BuildArch: noarch
%if %{with libalternatives}
BuildRequires: alts
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
%if %{with test}
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module Sphinx = %{version}}
@@ -208,10 +228,10 @@ This package contains the documentation for Sphinx.
Summary: Man files for python-Sphinx
Group: Documentation/Man
Requires: python3-Sphinx = %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Supplements: python3-Sphinx
Obsoletes: python-Sphinx-doc-man-common <= %{version}
BuildRequires: alts
Requires: alts
%description -n python-Sphinx-doc-man
Sphinx is a tool that facilitates creating documentation for Python
@@ -266,6 +286,7 @@ $python -m sphinx -b html -j auto ./doc ./build.doc/html
%python_clone -a %{buildroot}%{_bindir}/sphinx-autogen
%python_clone -a %{buildroot}%{_bindir}/sphinx-build
%python_clone -a %{buildroot}%{_bindir}/sphinx-quickstart
%python_group_libalternatives sphinx-apidoc sphinx-autogen sphinx-build sphinx-quickstart
%python_expand mkdir -p %{buildroot}%{$python_sitelib}/sphinxcontrib
%python_expand %fdupes %{buildroot}%{$python_sitelib}
@@ -281,6 +302,9 @@ grep -F %{$python_sitelib} ${langfile} >> %{$python_prefix}-${langfile} \
}
%python_find_lang sphinx
# libalternatives binaries break the kernel script for determining the Sphinx version
sed -i 's/import sys/import sys; sys.argv[0] = "sphinx-build"/' %{buildroot}%{_bindir}/sphinx-build-*
%else
%if 0%{?suse_version} > 1500
mkdir -p %{buildroot}%{_docdir}/python-Sphinx/
@@ -305,6 +329,9 @@ mv build.doc/man/sphinx-quickstart.1 %{buildroot}%{_mandir}/man1/sphinx-quicksta
%postun
%python_uninstall_alternative sphinx-apidoc
%pre
%python_libalternatives_reset_alternative sphinx-apidoc
%endif
%check

40
typing.patch Normal file
View File

@@ -0,0 +1,40 @@
From e01e42f5fc738815b8499c4ede30c6caf130f0a4 Mon Sep 17 00:00:00 2001
From: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Date: Wed, 19 Mar 2025 20:11:35 +0000
Subject: [PATCH] Fix ``INVALID_BUILTIN_CLASSES`` test for Python 3.14.0a6+
---
tests/test_util/test_util_typing.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/test_util/test_util_typing.py b/tests/test_util/test_util_typing.py
index 35ee240f7b8..8a561c378ed 100644
--- a/tests/test_util/test_util_typing.py
+++ b/tests/test_util/test_util_typing.py
@@ -205,7 +205,7 @@ def test_is_invalid_builtin_class() -> None:
zipfile.Path,
zipfile.CompleteDirs,
)
- if sys.version_info[:2] >= (3, 13):
+ if sys.version_info[:2] == (3, 13):
invalid_types += (
# pathlib
Path,
@@ -217,7 +217,7 @@ def test_is_invalid_builtin_class() -> None:
)
invalid_names = {(cls.__module__, cls.__qualname__) for cls in invalid_types}
- if sys.version_info[:2] < (3, 13):
+ if sys.version_info[:2] != (3, 13):
invalid_names |= {
('pathlib._local', 'Path'),
('pathlib._local', 'PosixPath'),
@@ -231,7 +231,7 @@ def test_is_invalid_builtin_class() -> None:
('zipfile._path', 'Path'),
('zipfile._path', 'CompleteDirs'),
}
- assert _INVALID_BUILTIN_CLASSES.keys() == invalid_names
+ assert set(_INVALID_BUILTIN_CLASSES) == invalid_names
def test_restify_type_hints_containers():