diff options
author | Zuul <zuul@review.opendev.org> | 2023-04-17 11:26:34 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2023-04-17 11:26:34 +0000 |
commit | 328b6243c70518b1ad109bbabe1f0e7d30b327f8 (patch) | |
tree | 3475d9a5c2225263cd18f44ce8d30a05e0341dd9 | |
parent | 8c63440f34ad7912ae07ca722a2fc3f76a4d30f2 (diff) | |
parent | 7d9fda625fd5e16c91a9b95920c477f857193389 (diff) | |
download | oslo-utils-328b6243c70518b1ad109bbabe1f0e7d30b327f8.tar.gz |
Merge "Implement zoneinfo support to drop dependency to pytz"
-rw-r--r-- | oslo_utils/timeutils.py | 6 | ||||
-rw-r--r-- | releasenotes/notes/implement-zoneinfo-to-remove-pytz-fba6f70db09ecdb8.yaml | 6 | ||||
-rw-r--r-- | requirements.txt | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/oslo_utils/timeutils.py b/oslo_utils/timeutils.py index 390be53..ba45fda 100644 --- a/oslo_utils/timeutils.py +++ b/oslo_utils/timeutils.py @@ -22,9 +22,9 @@ import datetime import functools import logging import time +import zoneinfo import iso8601 -import pytz from oslo_utils import reflection @@ -225,8 +225,8 @@ def unmarshall_time(tyme): if tzname: # Need to handle either iso8601 or python UTC format tzname = 'UTC' if tzname == 'UTC+00:00' else tzname - tzinfo = pytz.timezone(tzname) - dt = tzinfo.localize(dt) + tzinfo = zoneinfo.ZoneInfo(tzname) + dt = dt.replace(tzinfo=tzinfo) return dt diff --git a/releasenotes/notes/implement-zoneinfo-to-remove-pytz-fba6f70db09ecdb8.yaml b/releasenotes/notes/implement-zoneinfo-to-remove-pytz-fba6f70db09ecdb8.yaml new file mode 100644 index 0000000..24c7d7f --- /dev/null +++ b/releasenotes/notes/implement-zoneinfo-to-remove-pytz-fba6f70db09ecdb8.yaml @@ -0,0 +1,6 @@ +--- +other: + - | + Implement zoneinfo to allow us to remove pytz's dependency. zoneinfo + was introduced by python 3.9, and the series 2023.2 (bobcat) set py39 + as the minimal supported runtime, so we are able to remove pytz. diff --git a/requirements.txt b/requirements.txt index 37374ac..9085e00 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,9 +5,9 @@ iso8601>=0.1.11 # MIT oslo.i18n>=3.15.3 # Apache-2.0 -pytz>=2013.6 # MIT netaddr>=0.7.18 # BSD netifaces>=0.10.4 # MIT debtcollector>=1.2.0 # Apache-2.0 pyparsing>=2.1.0 # MIT packaging>=20.4 # BSD +tzdata>=2022.4 # MIT |