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>
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,22 +1,24 @@
# Prepared for Python 2 removal
%bcond_with python2
# Allow build without test
%bcond_without tests
%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_without python3
%else
%bcond_with python3
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif
Name: pytz
Version: 2019.3
Release: 4%{?dist}
Version: 2017.2
Release: 13%{?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/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
@ -25,10 +27,8 @@ 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
BuildRequires: python2-devel
BuildRequires: python2-pytest
%global _description\
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
%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
# Remove before F30
Provides: pytz = %{version}-%{release}
%{?python_provide:%python_provide python2-%{name}}
Obsoletes: pytz < %{version}-%{release}
%description -n python2-%{name} %_description
%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
%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 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
%py3_build
%{__python2} setup.py build
%if %{with python3}
%{__python3} setup.py build
%endif # with python3
%install
%if %{with python2}
%py2_install
%{__python2} setup.py install --skip-build --root %{buildroot}
chmod +x %{buildroot}%{python2_sitelib}/pytz/*.py
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
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
%if %{with tests}
%if %{with python2}
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -m pytest -v
%endif
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v
PYTHONPATH=%{buildroot}%{python2_sitelib} py.test-%{python2_version} -v
%if %{with python3}
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -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
%files -n python%{python3_pkgversion}-pytz
%if %{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
* Tue Jun 27 2023 Lumír Balhar <lbalhar@redhat.com> - 2017.2-13
- Fix FTBFS with newest tzdata
Resolves: rhbz#2217853
Resolves: rhbz#2217852
* Fri Dec 13 2019 Tomas Orsava <torsava@redhat.com> - 2019.3-3
- Exclude unsupported i686 arch
* Thu Apr 25 2019 Tomas Orsava <torsava@redhat.com> - 2017.2-12
- 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
- Adjusted for Python 3.8 module in RHEL 8
* Tue Oct 09 2018 Lumír Balhar <lbalhar@redhat.com> - 2017-2-11
- Remove unversioned provides
- Resolves: rhbz#1628242
* Mon Oct 07 2019 Gwyn Ciesla <gwync@protonmail.com> - 2019.3-1
- 2019.3
* Tue Oct 02 2018 Lumír Balhar <lbalhar@redhat.com> - 2017.2-10
- Fix unversioned requires/buildrequires
- Resolves: rhbz#1628242
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2019.2-3
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Tue Jul 31 2018 Lumír Balhar <lbalhar@redhat.com> - 2017.2-9
- Switch python3 coditions to bcond
* 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
- Fix ambiguous shebangs
* Sat Apr 28 2018 Tomas Orsava <torsava@redhat.com> - 2017.2-8
- Change the shebang to a versioned Python executable
* Sat Mar 17 2018 Matěj Cepl <mcepl@redhat.com> - 2017.2-7
- 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
+++ 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)

1
sources Normal file
View File

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