diff --git a/py314.patch b/py314.patch new file mode 100644 index 0000000..4428957 --- /dev/null +++ b/py314.patch @@ -0,0 +1,76 @@ +From 4cf05de26efa976b338458befffa4e9797f7458b Mon Sep 17 00:00:00 2001 +From: Maxwell G +Date: Tue, 26 Aug 2025 16:57:51 -0500 +Subject: [PATCH 1/2] tests: fix pathlib.PurePosixPath repr on py3.14 + +``` fish +for i in python3.{9,10,11,12,13,14} + echo -n "$i " + $i -c 'import pathlib; print(repr(pathlib.PurePosixPath))' +end +``` + +``` +python3.9 +python3.10 +python3.11 +python3.12 +python3.13 +python3.14 +``` +--- + tests/test_utils.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: domdf_python_tools-3.10.0/tests/test_utils.py +=================================================================== +--- domdf_python_tools-3.10.0.orig/tests/test_utils.py ++++ domdf_python_tools-3.10.0/tests/test_utils.py +@@ -124,7 +124,7 @@ def test_printr(obj, expects, capsys): + assert re.match(expects, stdout[0]) + + +-if sys.version_info >= (3, 13): ++if sys.version_info[:2] == (3, 13): + pure_posix_path_expected = "" + else: + pure_posix_path_expected = "" +Index: domdf_python_tools-3.10.0/domdf_python_tools/words.py +=================================================================== +--- domdf_python_tools-3.10.0.orig/domdf_python_tools/words.py ++++ domdf_python_tools-3.10.0/domdf_python_tools/words.py +@@ -171,14 +171,13 @@ def alpha_sort( + + alphabet_ = list(alphabet) + +- try: +- return sorted(iterable, key=lambda attr: [alphabet_.index(letter) for letter in attr], reverse=reverse) +- except ValueError as e: +- m = re.match(r"'(.*)' is not in list", str(e)) +- if m: +- raise ValueError(f"The character {m.group(1)!r} was not found in the alphabet.") from None +- else: # pragma: no cover +- raise e ++ def _alphabet_index(letter: str) -> int: ++ try: ++ return alphabet_.index(letter) ++ except ValueError: ++ raise ValueError(f"The character {letter!r} was not found in the alphabet.") from None ++ ++ return sorted(iterable, key=lambda attr: [_alphabet_index(letter) for letter in attr], reverse=reverse) + + + class Font(Dict[str, str]): +Index: domdf_python_tools-3.10.0/tests/test_paths.py +=================================================================== +--- domdf_python_tools-3.10.0.orig/tests/test_paths.py ++++ domdf_python_tools-3.10.0/tests/test_paths.py +@@ -925,7 +925,7 @@ else: + + + @pytest.mark.parametrize("path", _from_uri_paths) +-@pytest.mark.parametrize("left_type", [pathlib.PurePath, pathlib.Path, PathPlus]) ++@pytest.mark.parametrize("left_type", [pathlib.Path, PathPlus]) + def test_pathplus_from_uri(path: str, left_type: Type): + assert PathPlus.from_uri(left_type(path).as_uri()).as_posix() == path + diff --git a/python-domdf-python-tools.changes b/python-domdf-python-tools.changes index 6202e52..1c60858 100644 --- a/python-domdf-python-tools.changes +++ b/python-domdf-python-tools.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Sep 15 14:20:17 UTC 2025 - Markéta Machová + +- Add upstream py314.patch to support Python 3.14 + ------------------------------------------------------------------- Tue May 13 06:42:21 UTC 2025 - Steve Kowalik diff --git a/python-domdf-python-tools.spec b/python-domdf-python-tools.spec index e40e535..b293c18 100644 --- a/python-domdf-python-tools.spec +++ b/python-domdf-python-tools.spec @@ -1,7 +1,7 @@ # # spec file for package python-domdf-python-tools # -# 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 @@ -32,6 +32,9 @@ Summary: Helpful functions for Python 🐍 🛠️ License: MIT URL: https://github.com/domdfcoding/domdf_python_tools Source: https://github.com/domdfcoding/domdf_python_tools/archive/refs/tags/v%{version}.tar.gz#/domdf_python_tools-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/domdfcoding/domdf_python_tools/pull/137 Fix Python 3.14 test failures +# with one more fix from me (in the comments) +Patch0: py314.patch BuildRequires: %{python_module hatch-requirements-txt} BuildRequires: %{python_module pip} BuildRequires: python-rpm-macros @@ -72,7 +75,7 @@ Helpful functions for Python 🐍 🛠️ %check %if %{with test} # Broken upstream -%pytest -k 'not (test_discover_entry_points or test_iter_submodules)' +%pytest -k 'not (test_discover_entry_points)' %endif %if !%{with test}