Compare commits

..

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

8 changed files with 139 additions and 140 deletions

10
.gitignore vendored
View File

@ -1 +1,9 @@
SOURCES/pytz-2019.3.tar.gz pytz-2010h.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 @@
fc320b8b76a6067f16bbc3b8c365766978b5252f SOURCES/pytz-2019.3.tar.gz c2d0024d4a6bd649290813f0a57d849accf82fa9 pytz-2017.2.zip

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
# 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 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,13 +36,13 @@ 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'),
- '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,49 +1,42 @@
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) - filename = os.path.join(os.path.dirname(__file__),
- if zoneinfo_dir is not None: - 'zoneinfo', *name_parts)
- filename = os.path.join(zoneinfo_dir, *name_parts) - if not os.path.exists(filename):
- else: - # http://bugs.launchpad.net/bugs/383171 - we avoid using this
- filename = os.path.join(os.path.dirname(__file__), - # unless absolutely necessary to help when a broken version of
- 'zoneinfo', *name_parts) - # pkg_resources is installed.
- if not os.path.exists(filename): - try:
- # http://bugs.launchpad.net/bugs/383171 - we avoid using this - from pkg_resources import resource_stream
- # unless absolutely necessary to help when a broken version of - except ImportError:
- # pkg_resources is installed. - resource_stream = None
- 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)
+ 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,22 +1,24 @@
# Prepared for Python 2 removal %if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_with python2 %bcond_without python3
%else
# Allow build without test %bcond_with python3
%bcond_without tests %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif
Name: pytz Name: pytz
Version: 2019.3 Version: 2017.2
Release: 4%{?dist} Release: 13%{?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/2217852
# 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 +27,8 @@ 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 BuildRequires: python2-devel
# x86_64 compose of CRB, but we don't want to ship it at all. BuildRequires: python2-pytest
# 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,128 +41,110 @@ 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
%{?python_provide:%python_provide python2-%{name}}
BuildRequires: python2-devel
%if %{with tests}
BuildRequires: python2-pytest
%endif
Requires: tzdata Requires: tzdata
# Remove before F30 %{?python_provide:%python_provide python2-%{name}}
Provides: pytz = %{version}-%{release}
Obsoletes: pytz < %{version}-%{release} Obsoletes: pytz < %{version}-%{release}
%description -n python2-%{name} %_description %description -n python2-%{name} %_description
%endif
%if %{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} %{__python2} setup.py build
%py2_build %if %{with python3}
%endif %{__python3} setup.py build
%py3_build %endif # with python3
%install %install
%if %{with python2} %{__python2} setup.py install --skip-build --root %{buildroot}
%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}
%endif
%py3_install %if %{with python3}
%{__python3} setup.py install --skip-build --root %{buildroot}
rm -r %{buildroot}%{python3_sitelib}/pytz/zoneinfo rm -r %{buildroot}%{python3_sitelib}/pytz/zoneinfo
pathfix%{python3_version}.py -pn -i %{__python3} %{buildroot}%{python3_sitelib} %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
%check %check
%if %{with tests} PYTHONPATH=%{buildroot}%{python2_sitelib} py.test-%{python2_version} -v
%if %{with python2} %if %{with python3}
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -m pytest -v PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -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 README.txt %doc CHANGES.txt README.txt
%{python2_sitelib}/pytz/ %{python2_sitelib}/pytz/
%{python2_sitelib}/*.egg-info %{python2_sitelib}/*.egg-info
%endif
%files -n python%{python3_pkgversion}-pytz %if %{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 * Tue Jun 27 2023 Lumír Balhar <lbalhar@redhat.com> - 2017.2-13
- Fix FTBFS with newest tzdata - Fix FTBFS with newest tzdata
Resolves: rhbz#2217853 Resolves: rhbz#2217852
* Fri Dec 13 2019 Tomas Orsava <torsava@redhat.com> - 2019.3-3 * Thu Apr 25 2019 Tomas Orsava <torsava@redhat.com> - 2017.2-12
- Exclude unsupported i686 arch - Bumping due to problems with modular RPM upgrade path
- Resolves: rhbz#1695587
* Wed Nov 20 2019 Lumír Balhar <lbalhar@redhat.com> - 2019.3-2 * Tue Oct 09 2018 Lumír Balhar <lbalhar@redhat.com> - 2017-2-11
- Adjusted for Python 3.8 module in RHEL 8 - Remove unversioned provides
- Resolves: rhbz#1628242
* Mon Oct 07 2019 Gwyn Ciesla <gwync@protonmail.com> - 2019.3-1 * Tue Oct 02 2018 Lumír Balhar <lbalhar@redhat.com> - 2017.2-10
- 2019.3 - Fix unversioned requires/buildrequires
- Resolves: rhbz#1628242
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2019.2-3 * Tue Jul 31 2018 Lumír Balhar <lbalhar@redhat.com> - 2017.2-9
- Rebuilt for Python 3.8.0rc1 (#1748018) - Switch python3 coditions to bcond
* Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 2019.2-2 * Sat Apr 28 2018 Tomas Orsava <torsava@redhat.com> - 2017.2-8
- Rebuilt for Python 3.8 - Change the shebang to a versioned Python executable
* 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,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)

1
sources Normal file
View File

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