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 diff --git a/pytz/__init__.py b/pytz/__init__.py
--- pytz-2016.10/pytz/__init__.py.zoneinfo 2016-12-06 02:55:39.000000000 -0700 index 13c83b1..e8a674f 100644
+++ pytz-2016.10/pytz/__init__.py 2016-12-06 09:58:49.983107114 -0700 --- a/pytz/__init__.py
@@ -70,6 +70,10 @@ else: # Python 2.x +++ b/pytz/__init__.py
@@ -70,6 +70,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("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.
@@ -81,19 +85,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)
@ -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 - from pkg_resources import resource_stream
- except ImportError: - except ImportError:
- resource_stream = None - 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) + filename = os.path.join(_tzinfo_dir, *name_parts)
return open(filename, 'rb') return open(filename, 'rb')
@@ -490,1044 +483,34 @@ def _test(): @@ -490,1044 +481,33 @@ def _test():
if __name__ == '__main__': if __name__ == '__main__':
_test() _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_Acre',
- 'America/Porto_Velho', - 'America/Porto_Velho',
- 'America/Puerto_Rico', - 'America/Puerto_Rico',
- 'America/Punta_Arenas',
- 'America/Rainy_River', - 'America/Rainy_River',
- 'America/Rankin_Inlet', - 'America/Rankin_Inlet',
- 'America/Recife', - '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)] + del dirs[dirs.index(exclude)]
+ +
+ 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 != '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))
-
+
all_timezones_set = LazySet(all_timezones) all_timezones_set = LazySet(all_timezones)
-common_timezones = \ -common_timezones = \
-['Africa/Abidjan', -['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/Port_of_Spain',
- 'America/Porto_Velho', - 'America/Porto_Velho',
- 'America/Puerto_Rico', - 'America/Puerto_Rico',
- 'America/Punta_Arenas',
- 'America/Rainy_River', - 'America/Rainy_River',
- 'America/Rankin_Inlet', - 'America/Rankin_Inlet',
- 'America/Recife', - 'America/Recife',
@ -1054,7 +1055,6 @@ diff -up pytz-2016.10/pytz/__init__.py.zoneinfo pytz-2016.10/pytz/__init__.py
- 'Pacific/Guadalcanal', - 'Pacific/Guadalcanal',
- 'Pacific/Guam', - 'Pacific/Guam',
- 'Pacific/Honolulu', - 'Pacific/Honolulu',
- 'Pacific/Johnston',
- 'Pacific/Kiritimati', - 'Pacific/Kiritimati',
- 'Pacific/Kosrae', - 'Pacific/Kosrae',
- 'Pacific/Kwajalein', - 'Pacific/Kwajalein',
@ -1086,20 +1086,18 @@ diff -up pytz-2016.10/pytz/__init__.py.zoneinfo pytz-2016.10/pytz/__init__.py
- '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] != '#']
+common_timezones.extend( +common_timezones.extend(
+ ['GMT', + ['GMT',
+ 'US/Alaska', + 'US/Alaska',
+ 'US/Arizona', + 'US/Arizona',
+ 'US/Central', + 'US/Central',
+ 'US/Eastern', + 'US/Eastern',
+ 'US/Hawaii', + 'US/Hawaii',
+ '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)
-
+
common_timezones_set = LazySet(common_timezones)

View File

@ -5,14 +5,14 @@
%endif %endif
Name: pytz Name: pytz
Version: 2016.10 Version: 2017.2
Release: 4%{?dist} Release: 1%{?dist}
Summary: World Timezone Definitions for Python Summary: World Timezone Definitions for Python
Group: Development/Languages 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}.tar.gz 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
@ -96,6 +96,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -v
%changelog %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 * Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2016.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild