- Add patch use-zoneinfo.patch:
* Use zoneinfo, rather than pytz. - Switch BuildRequires to zoneinfo and timezone. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-kombu?expand=0&rev=172
This commit is contained in:
parent
3e51175e61
commit
70197b2d84
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 12 02:16:37 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch use-zoneinfo.patch:
|
||||
* Use zoneinfo, rather than pytz.
|
||||
- Switch BuildRequires to zoneinfo and timezone.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 23 06:08:55 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
|
@ -26,11 +26,14 @@ Source: https://files.pythonhosted.org/packages/source/k/kombu/kombu-%{v
|
||||
# PATCH-FIX-OPENSUSE Use Pyro4 compatibility for now, upstream should switch
|
||||
# for 5.3
|
||||
Patch0: support-pyro-5.patch
|
||||
# PATCH-FIX-UPSTREAM Use zoneinfo, rather than pytz gh#celery/kombu#1680
|
||||
Patch1: use-zoneinfo.patch
|
||||
BuildRequires: %{python_module Brotli >= 1.0.0}
|
||||
BuildRequires: %{python_module PyYAML >= 3.10}
|
||||
BuildRequires: %{python_module Pyro5}
|
||||
BuildRequires: %{python_module SQLAlchemy}
|
||||
BuildRequires: %{python_module amqp >= 5.0.9}
|
||||
BuildRequires: %{python_module backports.zoneinfo if %python-base < 3.9}
|
||||
BuildRequires: %{python_module boto3 >= 1.9.12}
|
||||
BuildRequires: %{python_module cached-property}
|
||||
BuildRequires: %{python_module case >= 1.5.2}
|
||||
@ -38,12 +41,12 @@ 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}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildRequires: timezone
|
||||
Requires: python-amqp >= 5.0.9
|
||||
Requires: python-cached-property
|
||||
Requires: python-importlib-metadata >= 0.18
|
||||
|
87
use-zoneinfo.patch
Normal file
87
use-zoneinfo.patch
Normal file
@ -0,0 +1,87 @@
|
||||
From d9e705aa1c42af24adf49ca1ef3ae339abc908dc Mon Sep 17 00:00:00 2001
|
||||
From: Maxwell Muoto <41130755+max-muoto@users.noreply.github.com>
|
||||
Date: Thu, 30 Mar 2023 09:32:24 -0500
|
||||
Subject: [PATCH 01/30] Main
|
||||
|
||||
---
|
||||
kombu/asynchronous/timer.py | 10 +++++-----
|
||||
requirements/test.txt | 2 +-
|
||||
t/unit/utils/test_json.py | 7 +++++--
|
||||
3 files changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
Index: kombu-5.2.4/kombu/asynchronous/timer.py
|
||||
===================================================================
|
||||
--- kombu-5.2.4.orig/kombu/asynchronous/timer.py
|
||||
+++ kombu-5.2.4/kombu/asynchronous/timer.py
|
||||
@@ -13,23 +13,23 @@ from vine.utils import wraps
|
||||
|
||||
from kombu.log import get_logger
|
||||
|
||||
-try:
|
||||
- from pytz import utc
|
||||
-except ImportError: # pragma: no cover
|
||||
- utc = None
|
||||
+if sys.version_info >= (3, 9):
|
||||
+ from zoneinfo import ZoneInfo
|
||||
+else:
|
||||
+ from backports.zoneinfo import ZoneInfo
|
||||
|
||||
__all__ = ('Entry', 'Timer', 'to_timestamp')
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
DEFAULT_MAX_INTERVAL = 2
|
||||
-EPOCH = datetime.utcfromtimestamp(0).replace(tzinfo=utc)
|
||||
+EPOCH = datetime.utcfromtimestamp(0).replace(tzinfo=ZoneInfo("UTC"))
|
||||
IS_PYPY = hasattr(sys, 'pypy_version_info')
|
||||
|
||||
scheduled = namedtuple('scheduled', ('eta', 'priority', 'entry'))
|
||||
|
||||
|
||||
-def to_timestamp(d, default_timezone=utc, time=monotonic):
|
||||
+def to_timestamp(d, default_timezone=ZoneInfo("UTC"), time=monotonic):
|
||||
"""Convert datetime to timestamp.
|
||||
|
||||
If d' is already a timestamp, then that will be used.
|
||||
Index: kombu-5.2.4/requirements/test.txt
|
||||
===================================================================
|
||||
--- kombu-5.2.4.orig/requirements/test.txt
|
||||
+++ kombu-5.2.4/requirements/test.txt
|
||||
@@ -1,4 +1,3 @@
|
||||
-pytz>dev
|
||||
pytest~=7.0.1
|
||||
pytest-sugar
|
||||
Pyro4
|
||||
Index: kombu-5.2.4/t/unit/utils/test_json.py
|
||||
===================================================================
|
||||
--- kombu-5.2.4.orig/t/unit/utils/test_json.py
|
||||
+++ kombu-5.2.4/t/unit/utils/test_json.py
|
||||
@@ -3,13 +3,18 @@ from datetime import datetime
|
||||
from decimal import Decimal
|
||||
from unittest.mock import MagicMock, Mock
|
||||
from uuid import uuid4
|
||||
+import sys
|
||||
|
||||
import pytest
|
||||
-import pytz
|
||||
|
||||
from kombu.utils.encoding import str_to_bytes
|
||||
from kombu.utils.json import _DecodeError, dumps, loads
|
||||
|
||||
+if sys.version_info >= (3, 9):
|
||||
+ from zoneinfo import ZoneInfo
|
||||
+else:
|
||||
+ from backports.zoneinfo import ZoneInfo
|
||||
+
|
||||
|
||||
class Custom:
|
||||
|
||||
@@ -24,7 +29,7 @@ class test_JSONEncoder:
|
||||
|
||||
def test_datetime(self):
|
||||
now = datetime.utcnow()
|
||||
- now_utc = now.replace(tzinfo=pytz.utc)
|
||||
+ now_utc = now.replace(tzinfo=ZoneInfo("UTC"))
|
||||
stripped = datetime(*now.timetuple()[:3])
|
||||
serialized = loads(dumps({
|
||||
'datetime': now,
|
Loading…
Reference in New Issue
Block a user