16
0

Accepting request 1305105 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1305105
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-domdf-python-tools?expand=0&rev=4
This commit is contained in:
2025-09-17 14:37:16 +00:00
committed by Git OBS Bridge
3 changed files with 86 additions and 2 deletions

76
py314.patch Normal file
View File

@@ -0,0 +1,76 @@
From 4cf05de26efa976b338458befffa4e9797f7458b Mon Sep 17 00:00:00 2001
From: Maxwell G <maxwell@gtmx.me>
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 <class 'pathlib.PurePosixPath'>
python3.10 <class 'pathlib.PurePosixPath'>
python3.11 <class 'pathlib.PurePosixPath'>
python3.12 <class 'pathlib.PurePosixPath'>
python3.13 <class 'pathlib._local.PurePosixPath'>
python3.14 <class 'pathlib.PurePosixPath'>
```
---
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 = "<class 'pathlib._local.PurePosixPath'>"
else:
pure_posix_path_expected = "<class 'pathlib.PurePosixPath'>"
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

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Sep 15 14:20:17 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Add upstream py314.patch to support Python 3.14
-------------------------------------------------------------------
Tue May 13 06:42:21 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -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}