Accepting request 1089520 from devel:languages:python

- Add 0001-Support-redis-4.5.2.patch to support latest version of
  redis gh#celery/kombu#1735
- Add sqlalchemy-2.0.patch to support latest version of sqlalchemy
  gh#celery/kombu#1651

OBS-URL: https://build.opensuse.org/request/show/1089520
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-kombu?expand=0&rev=78
This commit is contained in:
Dominique Leuenberger 2023-05-29 20:47:46 +00:00 committed by Git OBS Bridge
commit c342bb8e36
4 changed files with 111 additions and 0 deletions

View File

@ -0,0 +1,44 @@
From 3402c3489c5dd9833208d51c67259190bedfa35a Mon Sep 17 00:00:00 2001
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
Date: Mon, 29 May 2023 08:59:01 +0200
Subject: [PATCH] Support redis >= 4.5.2
The redis-py 4.5.2 changes the UnixDomainSocketConnection class so now
it inherits from AbstractConnection:
https://github.com/redis/redis-py/releases/tag/v4.5.2
This patch makes sure that the health_check_interval parameter is
checked for the __init__ method of the main class and also the bases, so
it doesn't fail with the newer version of redis-py.
---
kombu/transport/redis.py | 14 +++++++++-----
requirements/extras/redis.txt | 2 +-
2 files changed, 10 insertions(+), 6 deletions(-)
Index: kombu-5.2.4/kombu/transport/redis.py
===================================================================
--- kombu-5.2.4.orig/kombu/transport/redis.py
+++ kombu-5.2.4/kombu/transport/redis.py
@@ -1139,11 +1139,17 @@ class Channel(virtual.Channel):
# If the connection class does not support the `health_check_interval`
# argument then remove it.
- if (
- hasattr(conn_class, '__init__') and
- not accepts_argument(conn_class.__init__, 'health_check_interval')
- ):
- connparams.pop('health_check_interval')
+ if hasattr(conn_class, '__init__'):
+ # check health_check_interval for the class and bases
+ # classes
+ classes = [conn_class]
+ if hasattr(conn_class, '__bases__'):
+ classes += list(conn_class.__bases__)
+ for klass in classes:
+ if accepts_argument(klass.__init__, 'health_check_interval'):
+ break
+ else: # no break
+ connparams.pop('health_check_interval')
if conninfo.ssl:
# Connection(ssl={}) must be a dict containing the keys:

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon May 29 07:15:15 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Add 0001-Support-redis-4.5.2.patch to support latest version of
redis gh#celery/kombu#1735
- Add sqlalchemy-2.0.patch to support latest version of sqlalchemy
gh#celery/kombu#1651
-------------------------------------------------------------------
Wed Apr 12 02:16:37 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>

View File

@ -28,6 +28,10 @@ Source: https://files.pythonhosted.org/packages/source/k/kombu/kombu-%{v
Patch0: support-pyro-5.patch
# PATCH-FIX-UPSTREAM Use zoneinfo, rather than pytz gh#celery/kombu#1680
Patch1: use-zoneinfo.patch
# PATCH-FIX-UPSTREAM gh#celery/kombu#1651
Patch2: sqlalchemy-2.0.patch
# PATCH-FIX-UPSTREAM gh#celery/kombu#1735
Patch3: 0001-Support-redis-4.5.2.patch
BuildRequires: %{python_module Brotli >= 1.0.0}
BuildRequires: %{python_module PyYAML >= 3.10}
BuildRequires: %{python_module Pyro5}
@ -41,6 +45,7 @@ BuildRequires: %{python_module importlib-metadata >= 0.18}
BuildRequires: %{python_module msgpack}
BuildRequires: %{python_module pycurl >= 7.43.0.2}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module pytz}
BuildRequires: %{python_module redis >= 3.4.1}
BuildRequires: %{python_module setuptools >= 20.6.7}
BuildRequires: %{python_module vine}

54
sqlalchemy-2.0.patch Normal file
View File

@ -0,0 +1,54 @@
Index: kombu-5.2.4/kombu/transport/sqlalchemy/__init__.py
===================================================================
--- kombu-5.2.4.orig/kombu/transport/sqlalchemy/__init__.py
+++ kombu-5.2.4/kombu/transport/sqlalchemy/__init__.py
@@ -58,7 +58,7 @@ import threading
from json import dumps, loads
from queue import Empty
-from sqlalchemy import create_engine
+from sqlalchemy import create_engine, text
from sqlalchemy.exc import OperationalError
from sqlalchemy.orm import sessionmaker
@@ -164,7 +164,7 @@ class Channel(virtual.Channel):
def _get(self, queue):
obj = self._get_or_create(queue)
if self.session.bind.name == 'sqlite':
- self.session.execute('BEGIN IMMEDIATE TRANSACTION')
+ self.session.execute(text('BEGIN IMMEDIATE TRANSACTION'))
try:
msg = self.session.query(self.message_cls) \
.with_for_update() \
Index: kombu-5.2.4/kombu/transport/sqlalchemy/models.py
===================================================================
--- kombu-5.2.4.orig/kombu/transport/sqlalchemy/models.py
+++ kombu-5.2.4/kombu/transport/sqlalchemy/models.py
@@ -4,7 +4,7 @@ import datetime
from sqlalchemy import (Boolean, Column, DateTime, ForeignKey, Index, Integer,
Sequence, SmallInteger, String, Text)
-from sqlalchemy.orm import relation
+from sqlalchemy.orm import relationship
from sqlalchemy.schema import MetaData
try:
@@ -35,7 +35,7 @@ class Queue:
@declared_attr
def messages(cls):
- return relation('Message', backref='queue', lazy='noload')
+ return relationship('Message', backref='queue', lazy='noload')
class Message:
Index: kombu-5.2.4/requirements/test.txt
===================================================================
--- kombu-5.2.4.orig/requirements/test.txt
+++ kombu-5.2.4/requirements/test.txt
@@ -1,3 +1,4 @@
-pytest~=7.0.1
+pytz
+pytest>=7.1.1
pytest-sugar
Pyro4