From 28153d102a2e1a508ba34b6320bf29925a66b1984e5b529652f68d17e6961774 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 15 Apr 2025 06:22:45 +0000 Subject: [PATCH] - 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/package/show/devel:languages:python/python-Beaker?expand=0&rev=65 --- avoid-dbm-sqlite3.patch | 40 ++++++++++++++++++++++++++++++++++++++++ python-Beaker.changes | 7 +++++++ python-Beaker.spec | 12 ++++++++---- 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 avoid-dbm-sqlite3.patch diff --git a/avoid-dbm-sqlite3.patch b/avoid-dbm-sqlite3.patch new file mode 100644 index 0000000..00f6e56 --- /dev/null +++ b/avoid-dbm-sqlite3.patch @@ -0,0 +1,40 @@ +From 4fea03d3cef673917d30ca70ab693e2f851f7260 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +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 +--- + 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')) diff --git a/python-Beaker.changes b/python-Beaker.changes index 0e66988..6f8c849 100644 --- a/python-Beaker.changes +++ b/python-Beaker.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Apr 15 06:20:51 UTC 2025 - Steve Kowalik + +- 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 diff --git a/python-Beaker.spec b/python-Beaker.spec index fdbe0c4..cec8bb5 100644 --- a/python-Beaker.spec +++ b/python-Beaker.spec @@ -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