From 1dedfd63343681310f8478aea8337a09b666e4e1 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Thu, 27 Mar 2025 08:41:54 +0100 Subject: [PATCH] Add compatibility with Python 3.14 --- 8962398b761c3d85a.patch | 29 +++++++++++++++++++++++++++++ e01e42f5fc738815b.patch | 40 ++++++++++++++++++++++++++++++++++++++++ python-sphinx.spec | 4 ++++ 3 files changed, 73 insertions(+) create mode 100644 8962398b761c3d85a.patch create mode 100644 e01e42f5fc738815b.patch diff --git a/8962398b761c3d85a.patch b/8962398b761c3d85a.patch new file mode 100644 index 0000000..3b49f67 --- /dev/null +++ b/8962398b761c3d85a.patch @@ -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'] diff --git a/e01e42f5fc738815b.patch b/e01e42f5fc738815b.patch new file mode 100644 index 0000000..a42c216 --- /dev/null +++ b/e01e42f5fc738815b.patch @@ -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(): diff --git a/python-sphinx.spec b/python-sphinx.spec index 7933894..d508614 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -54,6 +54,10 @@ Patch: sphinx-test_theming.patch # https://github.com/sphinx-doc/sphinx/pull/11747 Patch: Make-the-first-party-extensions-optional.patch +# Compatibility with Python 3.14 +Patch: https://github.com/sphinx-doc/sphinx/commit/8962398b761c3d85a.patch +Patch: https://github.com/sphinx-doc/sphinx/commit/e01e42f5fc738815b.patch + BuildArch: noarch BuildRequires: make