Compare commits

...

No commits in common. "c8-stream-3.8" and "c8-beta" have entirely different histories.

6 changed files with 105 additions and 130 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/pytz-2019.3.tar.gz SOURCES/pytz-2017.2.zip

View File

@ -1 +1 @@
fc320b8b76a6067f16bbc3b8c365766978b5252f SOURCES/pytz-2019.3.tar.gz c2d0024d4a6bd649290813f0a57d849accf82fa9 SOURCES/pytz-2017.2.zip

View File

@ -1,6 +1,6 @@
From 83155e2f3ecd3e136e1792611afd7faa48eb90f8 Mon Sep 17 00:00:00 2001 From c4bec783c884adc4ace6eea4eaa8748645b920bc Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com> From: Lumir Balhar <lbalhar@redhat.com>
Date: Thu, 13 Jul 2023 12:05:29 +0200 Date: Tue, 27 Jun 2023 18:28:20 +0200
Subject: [PATCH] Fix ftbfs with newer tzdata Subject: [PATCH] Fix ftbfs with newer tzdata
Newer tzdata contains some corrections of timezones having effect Newer tzdata contains some corrections of timezones having effect
@ -10,10 +10,10 @@ on years before 1930.
1 file changed, 5 insertions(+), 5 deletions(-) 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pytz/tests/test_tzinfo.py b/pytz/tests/test_tzinfo.py diff --git a/pytz/tests/test_tzinfo.py b/pytz/tests/test_tzinfo.py
index dda13b9..e3d5ccc 100644 index beb0490..094c2d3 100644
--- a/pytz/tests/test_tzinfo.py --- a/pytz/tests/test_tzinfo.py
+++ b/pytz/tests/test_tzinfo.py +++ b/pytz/tests/test_tzinfo.py
@@ -617,18 +617,18 @@ class LocalTestCase(unittest.TestCase): @@ -605,18 +605,18 @@ class LocalTestCase(unittest.TestCase):
loc_time = loc_tz.localize(datetime(1930, 5, 10, 0, 0, 0)) loc_time = loc_tz.localize(datetime(1930, 5, 10, 0, 0, 0))
# Actually +00:19:32, but Python datetime rounds this # Actually +00:19:32, but Python datetime rounds this
@ -36,7 +36,7 @@ index dda13b9..e3d5ccc 100644
loc_time = loc_tz.localize(datetime(2004, 2, 1, 0, 0, 0)) loc_time = loc_tz.localize(datetime(2004, 2, 1, 0, 0, 0))
self.assertEqual(loc_time.strftime('%Z%z'), 'CET+0100') self.assertEqual(loc_time.strftime('%Z%z'), 'CET+0100')
@@ -723,7 +723,7 @@ class LocalTestCase(unittest.TestCase): @@ -710,7 +710,7 @@ class LocalTestCase(unittest.TestCase):
loc_dt = utc_dt.astimezone(tz) loc_dt = utc_dt.astimezone(tz)
self.assertEqual( self.assertEqual(
loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'), loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'),

View File

@ -1,25 +1,21 @@
diff --git a/pytz/__init__.py b/pytz/__init__.py diff --git a/pytz/__init__.py b/pytz/__init__.py
index d217c96..2b1ac03 100644 index 13c83b1..e8a674f 100644
--- a/pytz/__init__.py --- a/pytz/__init__.py
+++ b/pytz/__init__.py +++ b/pytz/__init__.py
@@ -74,6 +74,9 @@ else: # Python 2.x @@ -70,6 +70,9 @@ else: # Python 2.x
""" """
return s.encode('ASCII') return s.encode('ASCII')
+_tzinfo_dir = os.getenv('PYTZ_TZDATADIR') or '/usr/share/zoneinfo' +_tzinfo_dir = os.getenv("TZDIR") or "/usr/share/zoneinfo"
+if _tzinfo_dir.endswith(os.sep): +if _tzinfo_dir.endswith(os.sep):
+ _tzinfo_dir = _tzinfo_dir[:-1] + _tzinfo_dir = _tzinfo_dir[:-1]
def open_resource(name): def open_resource(name):
"""Open a resource from the zoneinfo subdir for reading. """Open a resource from the zoneinfo subdir for reading.
@@ -88,23 +91,8 @@ def open_resource(name): @@ -81,19 +84,7 @@ def open_resource(name):
for part in name_parts: for part in name_parts:
if part == os.path.pardir or os.path.sep in part: if part == os.path.pardir or os.path.sep in part:
raise ValueError('Bad path segment: %r' % part) raise ValueError('Bad path segment: %r' % part)
- zoneinfo_dir = os.environ.get('PYTZ_TZDATADIR', None)
- if zoneinfo_dir is not None:
- filename = os.path.join(zoneinfo_dir, *name_parts)
- else:
- filename = os.path.join(os.path.dirname(__file__), - filename = os.path.join(os.path.dirname(__file__),
- 'zoneinfo', *name_parts) - 'zoneinfo', *name_parts)
- if not os.path.exists(filename): - if not os.path.exists(filename):
@ -33,17 +29,14 @@ index d217c96..2b1ac03 100644
- -
- if resource_stream is not None: - if resource_stream is not None:
- return resource_stream(__name__, 'zoneinfo/' + name) - return resource_stream(__name__, 'zoneinfo/' + name)
+ zoneinfo_dir = os.environ.get('PYTZ_TZDATADIR', _tzinfo_dir) + filename = os.path.join(_tzinfo_dir, *name_parts)
+ filename = os.path.join(zoneinfo_dir, *name_parts)
return open(filename, 'rb') return open(filename, 'rb')
--- pytz-2019.2/pytz/__init__.py~ 2019-07-31 12:32:00.000000000 -0500 @@ -490,1044 +481,33 @@ def _test():
+++ pytz-2019.2/pytz/__init__.py 2019-07-31 12:44:07.995969364 -0500
@@ -495,1044 +495,37 @@
if __name__ == '__main__': if __name__ == '__main__':
_test() _test()
-all_timezones = \ -all_timezones = \
-['Africa/Abidjan', -['Africa/Abidjan',
- 'Africa/Accra', - 'Africa/Accra',
@ -346,7 +339,6 @@ index d217c96..2b1ac03 100644
- 'Asia/Pontianak', - 'Asia/Pontianak',
- 'Asia/Pyongyang', - 'Asia/Pyongyang',
- 'Asia/Qatar', - 'Asia/Qatar',
- 'Asia/Qostanay',
- 'Asia/Qyzylorda', - 'Asia/Qyzylorda',
- 'Asia/Rangoon', - 'Asia/Rangoon',
- 'Asia/Riyadh', - 'Asia/Riyadh',
@ -420,6 +412,7 @@ index d217c96..2b1ac03 100644
- 'CST6CDT', - 'CST6CDT',
- 'Canada/Atlantic', - 'Canada/Atlantic',
- 'Canada/Central', - 'Canada/Central',
- 'Canada/East-Saskatchewan',
- 'Canada/Eastern', - 'Canada/Eastern',
- 'Canada/Mountain', - 'Canada/Mountain',
- 'Canada/Newfoundland', - 'Canada/Newfoundland',
@ -631,13 +624,13 @@ index d217c96..2b1ac03 100644
- 'US/Michigan', - 'US/Michigan',
- 'US/Mountain', - 'US/Mountain',
- 'US/Pacific', - 'US/Pacific',
- 'US/Pacific-New',
- 'US/Samoa', - 'US/Samoa',
- 'UTC', - 'UTC',
- 'Universal', - 'Universal',
- 'W-SU', - 'W-SU',
- 'WET', - 'WET',
- 'Zulu'] - 'Zulu']
+
+all_timezones = [] +all_timezones = []
+for root, dirs, files in os.walk(_tzinfo_dir): +for root, dirs, files in os.walk(_tzinfo_dir):
+ for exclude in 'posix', 'right': + for exclude in 'posix', 'right':
@ -646,9 +639,8 @@ index d217c96..2b1ac03 100644
+ +
+ all_timezones.extend(os.path.join(root, tz_file)[len(_tzinfo_dir)+1:] + all_timezones.extend(os.path.join(root, tz_file)[len(_tzinfo_dir)+1:]
+ for tz_file in files + for tz_file in files
+ if tz_file not in ['leapseconds', 'README', 'Theory'] + if tz_file != 'README' and tz_file != 'Theory'
+ and '.' not in tz_file) + and '.' not in tz_file)
+
all_timezones = LazyList( all_timezones = LazyList(
tz for tz in all_timezones if resource_exists(tz)) tz for tz in all_timezones if resource_exists(tz))
@ -923,7 +915,6 @@ index d217c96..2b1ac03 100644
- 'Asia/Pontianak', - 'Asia/Pontianak',
- 'Asia/Pyongyang', - 'Asia/Pyongyang',
- 'Asia/Qatar', - 'Asia/Qatar',
- 'Asia/Qostanay',
- 'Asia/Qyzylorda', - 'Asia/Qyzylorda',
- 'Asia/Riyadh', - 'Asia/Riyadh',
- 'Asia/Sakhalin', - 'Asia/Sakhalin',
@ -1094,7 +1085,6 @@ index d217c96..2b1ac03 100644
- 'US/Mountain', - 'US/Mountain',
- 'US/Pacific', - 'US/Pacific',
- 'UTC'] - 'UTC']
+
+common_timezones = [l.split()[2] +common_timezones = [l.split()[2]
+ for l in open(os.path.join(_tzinfo_dir, 'zone.tab')) + for l in open(os.path.join(_tzinfo_dir, 'zone.tab'))
+ if l != '' and l[0] != '#'] + if l != '' and l[0] != '#']
@ -1108,7 +1098,6 @@ index d217c96..2b1ac03 100644
+ 'US/Mountain', + 'US/Mountain',
+ 'US/Pacific', + 'US/Pacific',
+ 'UTC']) + 'UTC'])
+
common_timezones = LazyList( common_timezones = LazyList(
tz for tz in common_timezones if tz in all_timezones) tz for tz in common_timezones if tz in all_timezones)

View File

@ -1,12 +1,10 @@
diff --git a/pytz/tests/test_tzinfo.py b/pytz/tests/test_tzinfo.py
index b2640a8..4f5322b 100644
--- a/pytz/tests/test_tzinfo.py --- a/pytz/tests/test_tzinfo.py
+++ b/pytz/tests/test_tzinfo.py +++ b/pytz/tests/test_tzinfo.py
@@ -155,6 +155,7 @@ class PicklingTest(unittest.TestCase): @@ -146,6 +146,7 @@ class PicklingTest(unittest.TestCase):
self._roundtrip_tzinfo(localized_tz) self._roundtrip_tzinfo(localized_tz)
self._roundtrip_datetime(dt.replace(tzinfo=localized_tz)) self._roundtrip_datetime(dt.replace(tzinfo=localized_tz))
+ @unittest.skip('Fails with system-wide timezone database') + @unittest.skip('Fails with system-wide timezone database')
def testRoundtrip(self): def testRoundtrip(self):
dt = datetime(2004, 2, 1, 0, 0, 0)
for zone in pytz.all_timezones: for zone in pytz.all_timezones:
tz = pytz.timezone(zone)

View File

@ -1,22 +1,31 @@
# Prepared for Python 2 removal %if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_with python2 %global with_python3 1
%else
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif
# Allow build without test %if 0%{?rhel} > 7
%bcond_without tests # Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif
Name: pytz Name: pytz
Version: 2019.3 Version: 2017.2
Release: 4%{?dist} Release: 11%{?dist}
Summary: World Timezone Definitions for Python Summary: World Timezone Definitions for Python
Group: Development/Languages
License: MIT License: MIT
URL: http://pytz.sourceforge.net/ URL: http://pytz.sourceforge.net/
Source0: %pypi_source Source0: https://pypi.io/packages/source/p/%{name}/%{name}-%{version}.zip
# Patch to use the system supplied zoneinfo files # Patch to use the system supplied zoneinfo files
Patch0: pytz-zoneinfo.patch Patch0: pytz-zoneinfo.patch
# https://bugzilla.redhat.com/1497572 # https://bugzilla.redhat.com/1497572
Patch1: remove_tzinfo_test.patch Patch1: remove_tzinfo_test.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2217853 # https://bugzilla.redhat.com/2217873
# https://issues.redhat.com/browse/RHEL-677
# Upstream: https://github.com/stub42/pytz/commit/07aa4d962dae5cb7ced4f61fe85a9001a01676df # Upstream: https://github.com/stub42/pytz/commit/07aa4d962dae5cb7ced4f61fe85a9001a01676df
# Upstream changed the way it includes the tzdata which is something # Upstream changed the way it includes the tzdata which is something
# we cannot replicate downstream because we use the databse provided # we cannot replicate downstream because we use the databse provided
@ -25,10 +34,10 @@ Patch1: remove_tzinfo_test.patch
Patch2: fix_ftbfs_with_newer_tzdata.patch Patch2: fix_ftbfs_with_newer_tzdata.patch
BuildArch: noarch BuildArch: noarch
# Exclude i686 arch. Due to a modularity issue it's being added to the %if %{with python2}
# x86_64 compose of CRB, but we don't want to ship it at all. BuildRequires: python2-devel
# See: https://projects.engineering.redhat.com/browse/RCM-72605 BuildRequires: python2-pytest
ExcludeArch: i686 %endif # with python2
%global _description\ %global _description\
pytz brings the Olson tz database into Python. This library allows accurate\ pytz brings the Olson tz database into Python. This library allows accurate\
@ -41,125 +50,104 @@ Almost all (over 540) of the Olson timezones are supported.
%description %_description %description %_description
%if %{with python2} %if %{with python2}
%package -n python2-%{name} %package -n python2-%{name}
Summary: %summary Summary: %summary
%{?python_provide:%python_provide python2-%{name}}
BuildRequires: python2-devel
%if %{with tests}
BuildRequires: python2-pytest
%endif
Requires: tzdata Requires: tzdata
%{?python_provide:%python_provide python2-%{name}}
# Remove before F30 # Remove before F30
Provides: pytz = %{version}-%{release} Provides: pytz%{?_isa} = %{version}-%{release}
Obsoletes: pytz < %{version}-%{release} Obsoletes: pytz < %{version}-%{release}
%description -n python2-%{name} %_description %description -n python2-%{name} %_description
%endif %endif # with python2
%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-%{name} %package -n python3-%{name}
Summary: %summary Summary: World Timezone Definitions for Python
%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}} Group: Development/Languages
BuildRequires: python%{python3_pkgversion}-devel BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-rpm-macros BuildRequires: python3-devel
%if %{with tests} BuildRequires: python3-pytest
BuildRequires: python%{python3_pkgversion}-pytest
%endif
Requires: tzdata Requires: tzdata
%description -n python%{python3_pkgversion}-%{name} %_description %description -n python3-%{name}
pytz brings the Olson tz database into Python. This library allows accurate
and cross platform timezone calculations using Python 2.3 or higher. It
also solves the issue of ambiguous times at the end of daylight savings,
which you can read more about in the Python Library Reference
(datetime.tzinfo).
Almost all (over 540) of the Olson timezones are supported.
%endif
%prep %prep
%autosetup -p1 %setup -q
%patch0 -p1 -b .zoneinfo
%patch1 -p1 -b .removeTest
%patch2 -p1
%build %build
%if %{with python2} %if %{with python2}
%py2_build %py2_build
%endif %endif # with python2
%if 0%{?with_python3}
%py3_build %py3_build
%endif # with_python3
%install %install
%if %{with python2} %if %{with python2}
%py2_install %py2_install
chmod +x %{buildroot}%{python2_sitelib}/pytz/*.py
rm -r %{buildroot}%{python2_sitelib}/pytz/zoneinfo rm -r %{buildroot}%{python2_sitelib}/pytz/zoneinfo
pathfix.py -pn -i %{__python2} %{buildroot}%{python2_sitelib} pathfix.py -pn -i %{__python2} %{buildroot}%{python2_sitelib}
%endif %endif # with python2
%if 0%{?with_python3}
%py3_install %py3_install
rm -r %{buildroot}%{python3_sitelib}/pytz/zoneinfo rm -r %{buildroot}%{python3_sitelib}/pytz/zoneinfo
pathfix%{python3_version}.py -pn -i %{__python3} %{buildroot}%{python3_sitelib} pathfix.py -pn -i %{__python3} %{buildroot}%{python3_sitelib}
%endif # with_python3
%check %check
%if %{with tests}
%if %{with python2} %if %{with python2}
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -m pytest -v PYTHONPATH=%{buildroot}%{python2_sitelib} py.test-%{python2_version} -v
%endif # with python2
%if 0%{?with_python3}
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -v
%endif %endif
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v
%endif
%if %{with python2} %if %{with python2}
%files -n python2-%{name} %files -n python2-%{name}
%license LICENSE.txt %license LICENSE.txt
%doc README.txt %doc CHANGES.txt README.txt
%{python2_sitelib}/pytz/ %{python2_sitelib}/pytz/
%{python2_sitelib}/*.egg-info %{python2_sitelib}/*.egg-info
%endif %endif # with python2
%files -n python%{python3_pkgversion}-pytz %if 0%{?with_python3}
%files -n python3-pytz
%license LICENSE.txt %license LICENSE.txt
%doc README.txt %doc CHANGES.txt README.txt
%{python3_sitelib}/pytz/ %{python3_sitelib}/pytz/
%{python3_sitelib}/*.egg-info %{python3_sitelib}/*.egg-info
%endif # with_python3
%changelog %changelog
* Tue Jun 27 2023 Lumír Balhar <lbalhar@redhat.com> - 2019.3-4 * Thu Jul 13 2023 Lumír Balhar <lbalhar@redhat.com> - 2017.2-11
- Bump to add gating
Related: RHEL-677
* Tue Jun 27 2023 Lumír Balhar <lbalhar@redhat.com> - 2017.2-10
- Fix FTBFS with newest tzdata - Fix FTBFS with newest tzdata
Resolves: rhbz#2217853 Resolves: RHEL-677
* Fri Dec 13 2019 Tomas Orsava <torsava@redhat.com> - 2019.3-3 * Fri Jun 22 2018 Charalampos Stratakis <cstratak@redhat.com> - 2017.2-9
- Exclude unsupported i686 arch - Conditionalize the python2 subpackage
* Wed Nov 20 2019 Lumír Balhar <lbalhar@redhat.com> - 2019.3-2
- Adjusted for Python 3.8 module in RHEL 8
* Mon Oct 07 2019 Gwyn Ciesla <gwync@protonmail.com> - 2019.3-1
- 2019.3
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2019.2-3
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 2019.2-2
- Rebuilt for Python 3.8
* Wed Jul 31 2019 Gwyn Ciesla <gwync@protonmail.com> - 2019.2-1
- 2019.2
* Fri Jul 26 2019 Gwyn Ciesla <gwync@protonmail.com> - 2019.1-1
- 2019.1
* Tue Mar 12 2019 Miro Hrončok <mhroncok@redhat.com> - 2018.9-1
- Update to 2018.9
- Remove leapseconds from pytz.all_timezones (#1642003)
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2018.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Aug 23 2018 Miro Hrončok <mhroncok@redhat.com> - 2018.5-1
- Update to 2018.5 (#1508227)
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2017.2-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jun 14 2018 Miro Hrončok <mhroncok@redhat.com> - 2017.2-9
- Rebuilt for Python 3.7
* Wed May 23 2018 Miro Hrončok <mhroncok@redhat.com> - 2017.2-8 * Wed May 23 2018 Miro Hrončok <mhroncok@redhat.com> - 2017.2-8
- Fix ambiguous shebangs - Fix ambiguous shebangs