Compare commits

...

No commits in common. "stream-python27-2.7-rhel-8.9.0" and "c8-stream-3.8" have entirely different histories.

8 changed files with 144 additions and 143 deletions

10
.gitignore vendored
View File

@ -1,9 +1 @@
pytz-2010h.tar.gz SOURCES/pytz-2019.3.tar.gz
/pytz-2012d.tar.gz
/pytz-2015.4.tar.gz
/pytz-2015.7.tar.gz
/pytz-2016.4.tar.gz
/pytz-2016.6.1.tar.gz
/pytz-2016.7.tar.gz
/pytz-2016.10.tar.gz
/pytz-2017.2.zip

View File

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

View File

@ -1,21 +0,0 @@
# Makefile for source rpm: pytz
# $Id$
NAME := pytz
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,6 +1,6 @@
From c4bec783c884adc4ace6eea4eaa8748645b920bc Mon Sep 17 00:00:00 2001 From 83155e2f3ecd3e136e1792611afd7faa48eb90f8 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com> From: Lumir Balhar <lbalhar@redhat.com>
Date: Tue, 27 Jun 2023 18:28:20 +0200 Date: Thu, 13 Jul 2023 12:05:29 +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 beb0490..094c2d3 100644 index dda13b9..e3d5ccc 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
@@ -605,18 +605,18 @@ class LocalTestCase(unittest.TestCase): @@ -617,18 +617,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,13 +36,13 @@ index beb0490..094c2d3 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')
@@ -710,7 +710,7 @@ class LocalTestCase(unittest.TestCase): @@ -723,7 +723,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'),
- '1914-01-01 14:00:00 AMT+0020' - '1914-01-01 14:00:00 AMT+0020'
+ '1914-01-01 13:40:00 WET+0000' + '1914-01-01 13:40:00 WET+0000'
) )
# And get back... # And get back...
-- --

View File

@ -1,42 +1,49 @@
diff --git a/pytz/__init__.py b/pytz/__init__.py diff --git a/pytz/__init__.py b/pytz/__init__.py
index 13c83b1..e8a674f 100644 index d217c96..2b1ac03 100644
--- a/pytz/__init__.py --- a/pytz/__init__.py
+++ b/pytz/__init__.py +++ b/pytz/__init__.py
@@ -70,6 +70,9 @@ else: # Python 2.x @@ -74,6 +74,9 @@ else: # Python 2.x
""" """
return s.encode('ASCII') return s.encode('ASCII')
+_tzinfo_dir = os.getenv("TZDIR") or "/usr/share/zoneinfo" +_tzinfo_dir = os.getenv('PYTZ_TZDATADIR') 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.
@@ -81,19 +84,7 @@ def open_resource(name): @@ -88,23 +91,8 @@ 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)
- filename = os.path.join(os.path.dirname(__file__), - zoneinfo_dir = os.environ.get('PYTZ_TZDATADIR', None)
- 'zoneinfo', *name_parts) - if zoneinfo_dir is not None:
- if not os.path.exists(filename): - filename = os.path.join(zoneinfo_dir, *name_parts)
- # http://bugs.launchpad.net/bugs/383171 - we avoid using this - else:
- # unless absolutely necessary to help when a broken version of - filename = os.path.join(os.path.dirname(__file__),
- # pkg_resources is installed. - 'zoneinfo', *name_parts)
- try: - if not os.path.exists(filename):
- from pkg_resources import resource_stream - # http://bugs.launchpad.net/bugs/383171 - we avoid using this
- except ImportError: - # unless absolutely necessary to help when a broken version of
- resource_stream = None - # pkg_resources is installed.
- try:
- from pkg_resources import resource_stream
- except ImportError:
- resource_stream = None
- -
- if resource_stream is not None: - if resource_stream is not None:
- return resource_stream(__name__, 'zoneinfo/' + name) - return resource_stream(__name__, 'zoneinfo/' + name)
+ filename = os.path.join(_tzinfo_dir, *name_parts) + zoneinfo_dir = os.environ.get('PYTZ_TZDATADIR', _tzinfo_dir)
+ filename = os.path.join(zoneinfo_dir, *name_parts)
return open(filename, 'rb') return open(filename, 'rb')
@@ -490,1044 +481,33 @@ def _test(): --- 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 @@
if __name__ == '__main__': if __name__ == '__main__':
_test() _test()
-all_timezones = \ -all_timezones = \
-['Africa/Abidjan', -['Africa/Abidjan',
- 'Africa/Accra', - 'Africa/Accra',
@ -339,6 +346,7 @@ index 13c83b1..e8a674f 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',
@ -412,7 +420,6 @@ index 13c83b1..e8a674f 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',
@ -624,13 +631,13 @@ index 13c83b1..e8a674f 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':
@ -639,8 +646,9 @@ index 13c83b1..e8a674f 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 != 'README' and tz_file != 'Theory' + if tz_file not in ['leapseconds', 'README', '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))
@ -915,6 +923,7 @@ index 13c83b1..e8a674f 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',
@ -1085,6 +1094,7 @@ index 13c83b1..e8a674f 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] != '#']
@ -1098,6 +1108,7 @@ index 13c83b1..e8a674f 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,10 +1,12 @@
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
@@ -146,6 +146,7 @@ class PicklingTest(unittest.TestCase): @@ -155,6 +155,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,24 +1,22 @@
%if 0%{?fedora} || 0%{?rhel} >= 8 # Prepared for Python 2 removal
%bcond_without python3 %bcond_with python2
%else
%bcond_with python3 # Allow build without test
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %bcond_without tests
%endif
Name: pytz Name: pytz
Version: 2017.2 Version: 2019.3
Release: 13%{?dist} Release: 4%{?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: https://pypi.io/packages/source/p/%{name}/%{name}-%{version}.zip Source0: %pypi_source
# 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/2217852 # https://bugzilla.redhat.com/show_bug.cgi?id=2217853
# 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
@ -27,8 +25,10 @@ Patch1: remove_tzinfo_test.patch
Patch2: fix_ftbfs_with_newer_tzdata.patch Patch2: fix_ftbfs_with_newer_tzdata.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python2-devel # Exclude i686 arch. Due to a modularity issue it's being added to the
BuildRequires: python2-pytest # 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
%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,110 +41,128 @@ Almost all (over 540) of the Olson timezones are supported.
%description %_description %description %_description
%if %{with python2}
%package -n python2-%{name} %package -n python2-%{name}
Summary: %summary Summary: %summary
Requires: tzdata
%{?python_provide:%python_provide python2-%{name}} %{?python_provide:%python_provide python2-%{name}}
BuildRequires: python2-devel
%if %{with tests}
BuildRequires: python2-pytest
%endif
Requires: tzdata
# Remove before F30
Provides: pytz = %{version}-%{release}
Obsoletes: pytz < %{version}-%{release} Obsoletes: pytz < %{version}-%{release}
%description -n python2-%{name} %_description %description -n python2-%{name} %_description
%if %{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 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 %endif
%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
Requires: tzdata
%description -n python%{python3_pkgversion}-%{name} %_description
%prep %prep
%setup -q %autosetup -p1
%patch0 -p1 -b .zoneinfo
%patch1 -p1 -b .removeTest
%patch2 -p1
%build %build
%{__python2} setup.py build %if %{with python2}
%if %{with python3} %py2_build
%{__python3} setup.py build %endif
%endif # with python3 %py3_build
%install %install
%{__python2} setup.py install --skip-build --root %{buildroot} %if %{with python2}
chmod +x %{buildroot}%{python2_sitelib}/pytz/*.py %py2_install
rm -r %{buildroot}%{python2_sitelib}/pytz/zoneinfo rm -r %{buildroot}%{python2_sitelib}/pytz/zoneinfo
pathfix.py -pn -i %{__python2} %{buildroot}%{python2_sitelib}
%if %{with python3}
%{__python3} setup.py install --skip-build --root %{buildroot}
rm -r %{buildroot}%{python3_sitelib}/pytz/zoneinfo
%endif # with python3
# Change the shebang to a versioned Python executable
sed -i "1s:^#!/usr/bin/env python$:#!%{__python2}:" \
%{buildroot}%{python2_sitelib}/pytz/tzfile.py
%if %{with python3}
sed -i "1s:^#!/usr/bin/env python$:#!%{__python3}:" \
%{buildroot}%{python3_sitelib}/pytz/tzfile.py
%endif %endif
%py3_install
rm -r %{buildroot}%{python3_sitelib}/pytz/zoneinfo
pathfix%{python3_version}.py -pn -i %{__python3} %{buildroot}%{python3_sitelib}
%check %check
PYTHONPATH=%{buildroot}%{python2_sitelib} py.test-%{python2_version} -v %if %{with tests}
%if %{with python3} %if %{with python2}
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -v PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -m pytest -v
%endif
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v
%endif %endif
%if %{with python2}
%files -n python2-%{name} %files -n python2-%{name}
%license LICENSE.txt %license LICENSE.txt
%doc CHANGES.txt README.txt %doc README.txt
%{python2_sitelib}/pytz/ %{python2_sitelib}/pytz/
%{python2_sitelib}/*.egg-info %{python2_sitelib}/*.egg-info
%endif
%if %{with python3} %files -n python%{python3_pkgversion}-pytz
%files -n python3-pytz
%license LICENSE.txt %license LICENSE.txt
%doc CHANGES.txt README.txt %doc 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> - 2017.2-13 * Tue Jun 27 2023 Lumír Balhar <lbalhar@redhat.com> - 2019.3-4
- Fix FTBFS with newest tzdata - Fix FTBFS with newest tzdata
Resolves: rhbz#2217852 Resolves: rhbz#2217853
* Thu Apr 25 2019 Tomas Orsava <torsava@redhat.com> - 2017.2-12 * Fri Dec 13 2019 Tomas Orsava <torsava@redhat.com> - 2019.3-3
- Bumping due to problems with modular RPM upgrade path - Exclude unsupported i686 arch
- Resolves: rhbz#1695587
* Tue Oct 09 2018 Lumír Balhar <lbalhar@redhat.com> - 2017-2-11 * Wed Nov 20 2019 Lumír Balhar <lbalhar@redhat.com> - 2019.3-2
- Remove unversioned provides - Adjusted for Python 3.8 module in RHEL 8
- Resolves: rhbz#1628242
* Tue Oct 02 2018 Lumír Balhar <lbalhar@redhat.com> - 2017.2-10 * Mon Oct 07 2019 Gwyn Ciesla <gwync@protonmail.com> - 2019.3-1
- Fix unversioned requires/buildrequires - 2019.3
- Resolves: rhbz#1628242
* Tue Jul 31 2018 Lumír Balhar <lbalhar@redhat.com> - 2017.2-9 * Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2019.2-3
- Switch python3 coditions to bcond - Rebuilt for Python 3.8.0rc1 (#1748018)
* Sat Apr 28 2018 Tomas Orsava <torsava@redhat.com> - 2017.2-8 * Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 2019.2-2
- Change the shebang to a versioned Python executable - 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
- Fix ambiguous shebangs
* Sat Mar 17 2018 Matěj Cepl <mcepl@redhat.com> - 2017.2-7 * Sat Mar 17 2018 Matěj Cepl <mcepl@redhat.com> - 2017.2-7
- Switch __python for __python2 macro. - Switch __python for __python2 macro.

View File

@ -1 +0,0 @@
SHA512 (pytz-2017.2.zip) = d67d64a64b4c21e0bd41da56020fc7b016aec9da7f3243f79b65704119f70b8a9cd4f5f905631b6761e06ecef93830e5e479e16c7b1611ac70e0cd2b39d5b916