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 This allows us to replace external pytz library by built-in zoneinfo module which was added in Python 3.9 . Change-Id: I611f5f2ec305671c97cffc78d26cc29bd556394d
This commit is contained in:
parent
dd37e3eb27
commit
a31cd0bf58
@ -13,8 +13,7 @@
|
||||
# the License.
|
||||
|
||||
import datetime
|
||||
|
||||
import pytz
|
||||
import zoneinfo
|
||||
|
||||
TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%f%z"
|
||||
|
||||
@ -24,11 +23,11 @@ def get_utc_now(timezone=None):
|
||||
|
||||
:param timezone: an optional timezone param to offset time to.
|
||||
"""
|
||||
utc_datetime = pytz.utc.localize(datetime.datetime.now(
|
||||
datetime.timezone.utc).replace(tzinfo=None))
|
||||
utc_datetime = datetime.datetime.now(datetime.timezone.utc)
|
||||
if timezone is not None:
|
||||
try:
|
||||
utc_datetime = utc_datetime.astimezone(pytz.timezone(timezone))
|
||||
tz = zoneinfo.Zoneinfo(timezone)
|
||||
utc_datetime = utc_datetime.astimezone(tz=tz)
|
||||
except Exception:
|
||||
utc_datetime.strftime(TIME_FORMAT)
|
||||
return utc_datetime.strftime(TIME_FORMAT)
|
||||
|
5
releasenotes/notes/remove-py38-0cb8ed123d41888b.yaml
Normal file
5
releasenotes/notes/remove-py38-0cb8ed123d41888b.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Support for Python 3.8 has been removed. Now the minimum python version
|
||||
supported is 3.9 .
|
@ -3,4 +3,3 @@
|
||||
# you find any incorrect lower bounds, let us know or propose a fix.
|
||||
oslo.config>=5.2.0 # Apache-2.0
|
||||
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
||||
pytz>=2013.6 # MIT
|
||||
|
@ -6,7 +6,7 @@ summary = CADF Library
|
||||
description-file =
|
||||
README.rst
|
||||
home-page = https://docs.openstack.org/pycadf/latest/
|
||||
python-requires = >=3.8
|
||||
python-requires = >=3.9
|
||||
classifier =
|
||||
Development Status :: 5 - Production/Stable
|
||||
Environment :: OpenStack
|
||||
@ -17,7 +17,6 @@ classifier =
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3 :: Only
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
Programming Language :: Python :: 3.11
|
||||
|
Loading…
x
Reference in New Issue
Block a user