Merge "Remove Python 3.8 support"

This commit is contained in:
Zuul 2024-10-08 23:04:37 +00:00 committed by Gerrit Code Review
commit 12d733a1cc
4 changed files with 10 additions and 22 deletions

View File

@ -33,16 +33,10 @@ import functools
import itertools
import uuid
from xmlrpc import client as xmlrpclib
import zoneinfo
import msgpack
try:
import zoneinfo
except ImportError:
# zoneinfo is available in Python >= 3.9
from pytz import timezone
zoneinfo = None
from oslo_utils import importutils
netaddr = importutils.try_import("netaddr")
@ -243,11 +237,7 @@ class DateTimeHandler(object):
'microsecond': dt.microsecond,
}
if dt.tzinfo:
if zoneinfo:
tz = str(dt.tzinfo)
else:
tz = dt.tzinfo.tzname(None)
dct['tz'] = tz
dct['tz'] = str(dt.tzinfo)
return dumps(dct, registry=self._registry)
def deserialize(self, blob):
@ -274,12 +264,7 @@ class DateTimeHandler(object):
second=dct['second'],
microsecond=dct['microsecond'])
if 'tz' in dct and dct['tz']:
if zoneinfo:
tzinfo = zoneinfo.ZoneInfo(dct['tz'])
dt = dt.replace(tzinfo=tzinfo)
else:
tzinfo = timezone(dct['tz'])
dt = tzinfo.localize(dt)
dt = dt.replace(tzinfo=zoneinfo.ZoneInfo(dct['tz']))
return dt

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Support for Python 3.8 has been removed. Now the minimum python version
supported is 3.9 .

View File

@ -6,5 +6,4 @@
pbr>=2.0.0 # Apache-2.0
msgpack>=0.5.2 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
pytz>=2013.6;python_version<"3.9" # MIT
tzdata>=2022.4;python_version>="3.9" # MIT
tzdata>=2022.4 # MIT

View File

@ -6,7 +6,7 @@ description_file =
author = OpenStack
author_email = openstack-discuss@lists.openstack.org
home_page = https://docs.openstack.org/oslo.serialization/latest/
python_requires = >=3.8
python_requires = >=3.9
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
@ -15,7 +15,6 @@ classifier =
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11