15
0
forked from pool/python-Beaker

Accepting request 1269441 from devel:languages:python

- Switch to pyproject macros.
- Add patch avoid-dbm-sqlite3.patch:
  * Avoid dbm.sqlite3 to support testing with Python 3.13.

OBS-URL: https://build.opensuse.org/request/show/1269441
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Beaker?expand=0&rev=35
This commit is contained in:
2025-04-16 18:39:18 +00:00
committed by Git OBS Bridge
3 changed files with 55 additions and 4 deletions

40
avoid-dbm-sqlite3.patch Normal file
View File

@@ -0,0 +1,40 @@
From 4fea03d3cef673917d30ca70ab693e2f851f7260 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Fri, 21 Jun 2024 12:32:19 -0700
Subject: [PATCH] Avoid using dbm.sqlite3 (#242)
Python 3.13 added a new dbm backend, dbm.sqlite3, as the most-
preferred choice when you do `import dbm`. This backend causes
our test suite to fail with sqlite3 threading violations. This
tweaks our dbm loading to just skip sqlite3 and try the other
possible backends in the same order as Python < 3.13 did.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
beaker/_compat.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/beaker/_compat.py b/beaker/_compat.py
index d7bac174..fd2ed42e 100644
--- a/beaker/_compat.py
+++ b/beaker/_compat.py
@@ -28,10 +28,17 @@
import http.cookies as http_cookies
from base64 import b64decode as _b64decode, b64encode as _b64encode
+ # this reproduces the default behavior of Python 3.0 to 3.12
+ # Python 3.13 added dbm.sqlite3 as the first choice, but it
+ # doesn't work for us due to threading violations:
+ # https://github.com/bbangert/beaker/issues/242
try:
- import dbm as anydbm
+ import dbm.gnu as anydbm
except:
- import dumbdbm as anydbm
+ try:
+ import dbm.ndbm as anydbm
+ except:
+ import dbm.dumb as anydbm
def b64decode(b):
return _b64decode(b.encode('ascii'))

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Apr 15 06:20:51 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Switch to pyproject macros.
- Add patch avoid-dbm-sqlite3.patch:
* Avoid dbm.sqlite3 to support testing with Python 3.13.
-------------------------------------------------------------------
Sat Apr 20 13:26:25 UTC 2024 - Dirk Müller <dmueller@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-Beaker
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -25,11 +25,14 @@ URL: https://github.com/bbangert/beaker
Source: https://github.com/bbangert/beaker/archive/%{version}.tar.gz
# PATCH-FIX-OPENSUSE Support pymemcache
Patch0: support-pymemcache.patch
# PATCH-FIX-UPSTREAM gh#AdamWill/beaker#4fea03d3cef673917d30ca70ab693e2f851f7260
Patch1: avoid-dbm-sqlite3.patch
BuildRequires: %{python_module SQLAlchemy}
BuildRequires: %{python_module WebTest}
BuildRequires: %{python_module coverage}
BuildRequires: %{python_module cryptography}
BuildRequires: %{python_module dbm}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pycryptodome}
BuildRequires: %{python_module pylibmc}
BuildRequires: %{python_module pymemcache}
@@ -37,6 +40,7 @@ BuildRequires: %{python_module pymongo}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module redis}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: glibc-locale
BuildRequires: python-rpm-macros
@@ -88,10 +92,10 @@ Features include:
%autosetup -p1 -n beaker-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
@@ -109,6 +113,6 @@ pytest tests
%license LICENSE
%doc README.rst CHANGELOG
%{python_sitelib}/beaker/
%{python_sitelib}/Beaker-%{version}-py*.egg-info
%{python_sitelib}/beaker-%{version}.dist-info
%changelog