Update to 2017.2

This commit is contained in:
Petr Šabata 2017-07-17 21:37:30 +02:00
parent 67de44e3f3
commit 5aa97d2366
2 changed files with 32 additions and 31 deletions

View File

@ -1,18 +1,18 @@
diff -up pytz-2016.10/pytz/__init__.py.zoneinfo pytz-2016.10/pytz/__init__.py
--- pytz-2016.10/pytz/__init__.py.zoneinfo 2016-12-06 02:55:39.000000000 -0700
+++ pytz-2016.10/pytz/__init__.py 2016-12-06 09:58:49.983107114 -0700
@@ -70,6 +70,10 @@ else: # Python 2.x
diff --git a/pytz/__init__.py b/pytz/__init__.py
index 13c83b1..e8a674f 100644
--- a/pytz/__init__.py
+++ b/pytz/__init__.py
@@ -70,6 +70,9 @@ else: # Python 2.x
"""
return s.encode('ASCII')
+_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.
@@ -81,19 +85,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)
@ -26,14 +26,14 @@ diff -up pytz-2016.10/pytz/__init__.py.zoneinfo pytz-2016.10/pytz/__init__.py
- from pkg_resources import resource_stream
- except ImportError:
- resource_stream = None
-
- if resource_stream is not None:
- return resource_stream(__name__, 'zoneinfo/' + name)
+ filename = os.path.join(_tzinfo_dir, *name_parts)
return open(filename, 'rb')
@@ -490,1044 +483,34 @@ def _test():
@@ -490,1044 +481,33 @@ def _test():
if __name__ == '__main__':
_test()
@ -223,6 +223,7 @@ diff -up pytz-2016.10/pytz/__init__.py.zoneinfo pytz-2016.10/pytz/__init__.py
- 'America/Porto_Acre',
- 'America/Porto_Velho',
- 'America/Puerto_Rico',
- 'America/Punta_Arenas',
- 'America/Rainy_River',
- 'America/Rankin_Inlet',
- 'America/Recife',
@ -637,13 +638,12 @@ diff -up pytz-2016.10/pytz/__init__.py.zoneinfo pytz-2016.10/pytz/__init__.py
+ del dirs[dirs.index(exclude)]
+
+ all_timezones.extend(os.path.join(root, tz_file)[len(_tzinfo_dir)+1:]
+ for tz_file in files
+ if tz_file != 'README' and tz_file != 'Theory'
+ and '.' not in tz_file)
+ for tz_file in files
+ 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))
-
+
all_timezones_set = LazySet(all_timezones)
-common_timezones = \
-['Africa/Abidjan',
@ -814,6 +814,7 @@ diff -up pytz-2016.10/pytz/__init__.py.zoneinfo pytz-2016.10/pytz/__init__.py
- 'America/Port_of_Spain',
- 'America/Porto_Velho',
- 'America/Puerto_Rico',
- 'America/Punta_Arenas',
- 'America/Rainy_River',
- 'America/Rankin_Inlet',
- 'America/Recife',
@ -1054,7 +1055,6 @@ diff -up pytz-2016.10/pytz/__init__.py.zoneinfo pytz-2016.10/pytz/__init__.py
- 'Pacific/Guadalcanal',
- 'Pacific/Guam',
- 'Pacific/Honolulu',
- 'Pacific/Johnston',
- 'Pacific/Kiritimati',
- 'Pacific/Kosrae',
- 'Pacific/Kwajalein',
@ -1086,20 +1086,18 @@ diff -up pytz-2016.10/pytz/__init__.py.zoneinfo pytz-2016.10/pytz/__init__.py
- 'US/Pacific',
- 'UTC']
+common_timezones = [l.split()[2]
+ for l in open(os.path.join(_tzinfo_dir, 'zone.tab'))
+ if l != '' and l[0] != '#']
+ for l in open(os.path.join(_tzinfo_dir, 'zone.tab'))
+ if l != '' and l[0] != '#']
+common_timezones.extend(
+ ['GMT',
+ 'US/Alaska',
+ 'US/Arizona',
+ 'US/Central',
+ 'US/Eastern',
+ 'US/Hawaii',
+ 'US/Mountain',
+ 'US/Pacific',
+ 'UTC'])
+ ['GMT',
+ 'US/Alaska',
+ 'US/Arizona',
+ 'US/Central',
+ 'US/Eastern',
+ 'US/Hawaii',
+ 'US/Mountain',
+ 'US/Pacific',
+ 'UTC'])
common_timezones = LazyList(
tz for tz in common_timezones if tz in all_timezones)
-
+
common_timezones_set = LazySet(common_timezones)

View File

@ -5,14 +5,14 @@
%endif
Name: pytz
Version: 2016.10
Release: 4%{?dist}
Version: 2017.2
Release: 1%{?dist}
Summary: World Timezone Definitions for Python
Group: Development/Languages
License: MIT
URL: http://pytz.sourceforge.net/
Source0: https://pypi.io/packages/source/p/%{name}/%{name}-%{version}.tar.gz
Source0: https://pypi.io/packages/source/p/%{name}/%{name}-%{version}.zip
# Patch to use the system supplied zoneinfo files
Patch0: pytz-zoneinfo.patch
@ -96,6 +96,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -v
%changelog
* Mon Jul 17 2017 Petr Šabata <contyk@redhat.com> - 2017.2-1
- Update to 2017.2
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2016.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild