Compare commits

...

No commits in common. "c8-stream-3.8" and "c8" 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>
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
Newer tzdata contains some corrections of timezones having effect
@ -10,10 +10,10 @@ on years before 1930.
1 file changed, 5 insertions(+), 5 deletions(-)
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
+++ 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))
# Actually +00:19:32, but Python datetime rounds this
@ -36,13 +36,13 @@ index dda13b9..e3d5ccc 100644
loc_time = loc_tz.localize(datetime(2004, 2, 1, 0, 0, 0))
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)
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'
)
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...
--

View File

@ -1,49 +1,42 @@
diff --git a/pytz/__init__.py b/pytz/__init__.py
index d217c96..2b1ac03 100644
index 13c83b1..e8a674f 100644
--- a/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')
+_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):
+ _tzinfo_dir = _tzinfo_dir[:-1]
def open_resource(name):
"""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:
if part == os.path.pardir or os.path.sep in 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__),
- 'zoneinfo', *name_parts)
- if not os.path.exists(filename):
- # http://bugs.launchpad.net/bugs/383171 - we avoid using this
- # unless absolutely necessary to help when a broken version of
- # pkg_resources is installed.
- try:
- from pkg_resources import resource_stream
- except ImportError:
- resource_stream = None
- filename = os.path.join(os.path.dirname(__file__),
- 'zoneinfo', *name_parts)
- if not os.path.exists(filename):
- # http://bugs.launchpad.net/bugs/383171 - we avoid using this
- # unless absolutely necessary to help when a broken version of
- # pkg_resources is installed.
- try:
- from pkg_resources import resource_stream
- except ImportError:
- resource_stream = None
-
- if resource_stream is not None:
- return resource_stream(__name__, 'zoneinfo/' + name)
+ zoneinfo_dir = os.environ.get('PYTZ_TZDATADIR', _tzinfo_dir)
+ filename = os.path.join(zoneinfo_dir, *name_parts)
- if resource_stream is not None:
- return resource_stream(__name__, 'zoneinfo/' + name)
+ filename = os.path.join(_tzinfo_dir, *name_parts)
return open(filename, 'rb')
--- pytz-2019.2/pytz/__init__.py~ 2019-07-31 12:32:00.000000000 -0500
+++ pytz-2019.2/pytz/__init__.py 2019-07-31 12:44:07.995969364 -0500
@@ -495,1044 +495,37 @@
@@ -490,1044 +481,33 @@ def _test():
if __name__ == '__main__':
_test()
-all_timezones = \
-['Africa/Abidjan',
- 'Africa/Accra',
@ -346,7 +339,6 @@ index d217c96..2b1ac03 100644
- 'Asia/Pontianak',
- 'Asia/Pyongyang',
- 'Asia/Qatar',
- 'Asia/Qostanay',
- 'Asia/Qyzylorda',
- 'Asia/Rangoon',
- 'Asia/Riyadh',
@ -420,6 +412,7 @@ index d217c96..2b1ac03 100644
- 'CST6CDT',
- 'Canada/Atlantic',
- 'Canada/Central',
- 'Canada/East-Saskatchewan',
- 'Canada/Eastern',
- 'Canada/Mountain',
- 'Canada/Newfoundland',
@ -631,13 +624,13 @@ index d217c96..2b1ac03 100644
- 'US/Michigan',
- 'US/Mountain',
- 'US/Pacific',
- 'US/Pacific-New',
- 'US/Samoa',
- 'UTC',
- 'Universal',
- 'W-SU',
- 'WET',
- 'Zulu']
+
+all_timezones = []
+for root, dirs, files in os.walk(_tzinfo_dir):
+ 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:]
+ 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)
+
all_timezones = LazyList(
tz for tz in all_timezones if resource_exists(tz))
@ -923,7 +915,6 @@ index d217c96..2b1ac03 100644
- 'Asia/Pontianak',
- 'Asia/Pyongyang',
- 'Asia/Qatar',
- 'Asia/Qostanay',
- 'Asia/Qyzylorda',
- 'Asia/Riyadh',
- 'Asia/Sakhalin',
@ -1094,7 +1085,6 @@ index d217c96..2b1ac03 100644
- 'US/Mountain',
- 'US/Pacific',
- 'UTC']
+
+common_timezones = [l.split()[2]
+ for l in open(os.path.join(_tzinfo_dir, 'zone.tab'))
+ if l != '' and l[0] != '#']
@ -1108,7 +1098,6 @@ index d217c96..2b1ac03 100644
+ 'US/Mountain',
+ 'US/Pacific',
+ 'UTC'])
+
common_timezones = LazyList(
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
+++ 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_datetime(dt.replace(tzinfo=localized_tz))
+ @unittest.skip('Fails with system-wide timezone database')
def testRoundtrip(self):
dt = datetime(2004, 2, 1, 0, 0, 0)
for zone in pytz.all_timezones:
tz = pytz.timezone(zone)

View File

@ -1,22 +1,31 @@
# Prepared for Python 2 removal
%bcond_with python2
%if 0%{?fedora} || 0%{?rhel} >= 8
%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
%bcond_without tests
%if 0%{?rhel} > 7
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif
Name: pytz
Version: 2019.3
Release: 4%{?dist}
Version: 2017.2
Release: 11%{?dist}
Summary: World Timezone Definitions for Python
Group: Development/Languages
License: MIT
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
Patch0: pytz-zoneinfo.patch
# https://bugzilla.redhat.com/1497572
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 changed the way it includes the tzdata which is something
# 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
BuildArch: noarch
# Exclude i686 arch. Due to a modularity issue it's being added to the
# x86_64 compose of CRB, but we don't want to ship it at all.
# See: https://projects.engineering.redhat.com/browse/RCM-72605
ExcludeArch: i686
%if %{with python2}
BuildRequires: python2-devel
BuildRequires: python2-pytest
%endif # with python2
%global _description\
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
%if %{with python2}
%package -n python2-%{name}
Summary: %summary
%{?python_provide:%python_provide python2-%{name}}
BuildRequires: python2-devel
%if %{with tests}
BuildRequires: python2-pytest
%endif
Summary: %summary
Requires: tzdata
%{?python_provide:%python_provide python2-%{name}}
# Remove before F30
Provides: pytz = %{version}-%{release}
Provides: pytz%{?_isa} = %{version}-%{release}
Obsoletes: pytz < %{version}-%{release}
%description -n python2-%{name} %_description
%endif
%endif # with python2
%package -n python%{python3_pkgversion}-%{name}
Summary: %summary
%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-rpm-macros
%if %{with tests}
BuildRequires: python%{python3_pkgversion}-pytest
%endif
%if 0%{?with_python3}
%package -n python3-%{name}
Summary: World Timezone Definitions for Python
Group: Development/Languages
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-pytest
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
%autosetup -p1
%setup -q
%patch0 -p1 -b .zoneinfo
%patch1 -p1 -b .removeTest
%patch2 -p1
%build
%if %{with python2}
%py2_build
%endif
%endif # with python2
%if 0%{?with_python3}
%py3_build
%endif # with_python3
%install
%if %{with python2}
%py2_install
chmod +x %{buildroot}%{python2_sitelib}/pytz/*.py
rm -r %{buildroot}%{python2_sitelib}/pytz/zoneinfo
pathfix.py -pn -i %{__python2} %{buildroot}%{python2_sitelib}
%endif
%endif # with python2
%if 0%{?with_python3}
%py3_install
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
%if %{with tests}
%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
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v
%endif
%if %{with python2}
%files -n python2-%{name}
%license LICENSE.txt
%doc README.txt
%doc CHANGES.txt README.txt
%{python2_sitelib}/pytz/
%{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
%doc README.txt
%doc CHANGES.txt README.txt
%{python3_sitelib}/pytz/
%{python3_sitelib}/*.egg-info
%endif # with_python3
%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
Resolves: rhbz#2217853
Resolves: RHEL-677
* Fri Dec 13 2019 Tomas Orsava <torsava@redhat.com> - 2019.3-3
- Exclude unsupported i686 arch
* 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
* Fri Jun 22 2018 Charalampos Stratakis <cstratak@redhat.com> - 2017.2-9
- Conditionalize the python2 subpackage
* Wed May 23 2018 Miro Hrončok <mhroncok@redhat.com> - 2017.2-8
- Fix ambiguous shebangs