Remove Python 3.8 support

Python 3.8 is no longer part of the tested runtimes for 2024.2[1]
because its EOL is coming soon.

[1] https://governance.openstack.org/tc/reference/runtimes/2024.2.html

Change-Id: Iae3f0f329cf1503617b70c2253e39f3a17f4ee51
This commit is contained in:
Takashi Kajinami 2024-09-30 17:54:10 +09:00
parent f6e879db55
commit 799bbc9006
4 changed files with 10 additions and 22 deletions

View File

@ -33,16 +33,10 @@ import functools
import itertools import itertools
import uuid import uuid
from xmlrpc import client as xmlrpclib from xmlrpc import client as xmlrpclib
import zoneinfo
import msgpack 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 from oslo_utils import importutils
netaddr = importutils.try_import("netaddr") netaddr = importutils.try_import("netaddr")
@ -243,11 +237,7 @@ class DateTimeHandler(object):
'microsecond': dt.microsecond, 'microsecond': dt.microsecond,
} }
if dt.tzinfo: if dt.tzinfo:
if zoneinfo: dct['tz'] = str(dt.tzinfo)
tz = str(dt.tzinfo)
else:
tz = dt.tzinfo.tzname(None)
dct['tz'] = tz
return dumps(dct, registry=self._registry) return dumps(dct, registry=self._registry)
def deserialize(self, blob): def deserialize(self, blob):
@ -274,12 +264,7 @@ class DateTimeHandler(object):
second=dct['second'], second=dct['second'],
microsecond=dct['microsecond']) microsecond=dct['microsecond'])
if 'tz' in dct and dct['tz']: if 'tz' in dct and dct['tz']:
if zoneinfo: dt = dt.replace(tzinfo=zoneinfo.ZoneInfo(dct['tz']))
tzinfo = zoneinfo.ZoneInfo(dct['tz'])
dt = dt.replace(tzinfo=tzinfo)
else:
tzinfo = timezone(dct['tz'])
dt = tzinfo.localize(dt)
return dt 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 pbr>=2.0.0 # Apache-2.0
msgpack>=0.5.2 # Apache-2.0 msgpack>=0.5.2 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0
pytz>=2013.6;python_version<"3.9" # MIT tzdata>=2022.4 # MIT
tzdata>=2022.4;python_version>="3.9" # MIT

View File

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