From af1716fc5e1b3b0d473b9ee563e9b0fd5f9519dd Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Tue, 27 Jun 2023 18:32:41 +0200 Subject: [PATCH] Fix FTBFS with newest tzdata --- .pytz.metadata | 1 + fix_ftbfs_with_newer_tzdata.patch | 50 +++++++++++++++++++++++++++++++ pytz.spec | 14 ++++++++- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .pytz.metadata create mode 100644 fix_ftbfs_with_newer_tzdata.patch diff --git a/.pytz.metadata b/.pytz.metadata new file mode 100644 index 0000000..7c43e05 --- /dev/null +++ b/.pytz.metadata @@ -0,0 +1 @@ +c2d0024d4a6bd649290813f0a57d849accf82fa9 pytz-2017.2.zip diff --git a/fix_ftbfs_with_newer_tzdata.patch b/fix_ftbfs_with_newer_tzdata.patch new file mode 100644 index 0000000..ab7976e --- /dev/null +++ b/fix_ftbfs_with_newer_tzdata.patch @@ -0,0 +1,50 @@ +From c4bec783c884adc4ace6eea4eaa8748645b920bc Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Tue, 27 Jun 2023 18:28:20 +0200 +Subject: [PATCH] Fix ftbfs with newer tzdata + +Newer tzdata contains some corrections of timezones having effect +on years before 1930. +--- + pytz/tests/test_tzinfo.py | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/pytz/tests/test_tzinfo.py b/pytz/tests/test_tzinfo.py +index beb0490..094c2d3 100644 +--- a/pytz/tests/test_tzinfo.py ++++ b/pytz/tests/test_tzinfo.py +@@ -605,18 +605,18 @@ class LocalTestCase(unittest.TestCase): + + loc_time = loc_tz.localize(datetime(1930, 5, 10, 0, 0, 0)) + # Actually +00:19:32, but Python datetime rounds this +- self.assertEqual(loc_time.strftime('%Z%z'), 'AMT+0020') ++ self.assertEqual(loc_time.strftime('%Z%z'), 'WEST+0100') + + loc_time = loc_tz.localize(datetime(1930, 5, 20, 0, 0, 0)) + # Actually +00:19:32, but Python datetime rounds this +- self.assertEqual(loc_time.strftime('%Z%z'), 'NST+0120') ++ self.assertEqual(loc_time.strftime('%Z%z'), 'WEST+0100') + + loc_time = loc_tz.localize(datetime(1940, 5, 10, 0, 0, 0)) + # pre-2017a, abbreviation was NCT +- self.assertEqual(loc_time.strftime('%Z%z'), '+0020+0020') ++ self.assertEqual(loc_time.strftime('%Z%z'), 'WEST+0100') + + loc_time = loc_tz.localize(datetime(1940, 5, 20, 0, 0, 0)) +- self.assertEqual(loc_time.strftime('%Z%z'), 'CEST+0200') ++ self.assertEqual(loc_time.strftime('%Z%z'), 'WEST+0100') + + loc_time = loc_tz.localize(datetime(2004, 2, 1, 0, 0, 0)) + self.assertEqual(loc_time.strftime('%Z%z'), 'CET+0100') +@@ -710,7 +710,7 @@ class LocalTestCase(unittest.TestCase): + loc_dt = utc_dt.astimezone(tz) + self.assertEqual( + loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'), +- '1914-01-01 14:00:00 AMT+0020' ++ '1914-01-01 13:40:00 WET+0000' + ) + + # And get back... +-- +2.41.0 + diff --git a/pytz.spec b/pytz.spec index 4a6b44c..750bb11 100644 --- a/pytz.spec +++ b/pytz.spec @@ -7,7 +7,7 @@ Name: pytz Version: 2017.2 -Release: 12%{?dist} +Release: 13%{?dist} Summary: World Timezone Definitions for Python Group: Development/Languages @@ -18,6 +18,13 @@ Source0: https://pypi.io/packages/source/p/%{name}/%{name}-%{version}.zip Patch0: pytz-zoneinfo.patch # https://bugzilla.redhat.com/1497572 Patch1: remove_tzinfo_test.patch +# https://bugzilla.redhat.com/2217852 +# Upstream: https://github.com/stub42/pytz/commit/07aa4d962dae5cb7ced4f61fe85a9001a01676df +# Upstream changed the way it includes the tzdata which is something +# we cannot replicate downstream because we use the databse provided +# by tzdata component instead of the bundled one so the patch +# makes the tests pass with the latest version of tzdata. +Patch2: fix_ftbfs_with_newer_tzdata.patch BuildArch: noarch BuildRequires: python2-devel @@ -65,6 +72,7 @@ Almost all (over 540) of the Olson timezones are supported. %setup -q %patch0 -p1 -b .zoneinfo %patch1 -p1 -b .removeTest +%patch2 -p1 %build @@ -116,6 +124,10 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -v %changelog +* Tue Jun 27 2023 Lumír Balhar - 2017.2-13 +- Fix FTBFS with newest tzdata +Resolves: rhbz#2217852 + * Thu Apr 25 2019 Tomas Orsava - 2017.2-12 - Bumping due to problems with modular RPM upgrade path - Resolves: rhbz#1695587