From e6a0d421251f6c3292bf1172f3cdf5767c377c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Thu, 21 Jul 2016 08:22:41 +0200 Subject: [PATCH] Fix patch --- pytz-zoneinfo.patch | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pytz-zoneinfo.patch b/pytz-zoneinfo.patch index 5c0d789..908b0f4 100644 --- a/pytz-zoneinfo.patch +++ b/pytz-zoneinfo.patch @@ -1,7 +1,7 @@ --- a/pytz/__init__.py +++ b/pytz/__init__.py -@@ -13,7 +13,7 @@ OLSON_VERSION = '2016d' - VERSION = '2016.4' # Switching to pip compatible version numbering. +@@ -13,7 +13,7 @@ OLSON_VERSION = '2016f' + VERSION = '2016.6.1' # Switching to pip compatible version numbering. __version__ = VERSION -OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling @@ -9,36 +9,36 @@ __all__ = [ 'timezone', 'utc', 'country_timezones', 'country_names', -@@ -75,24 +75,19 @@ else: # Python 2.x - """ - return s.encode('US-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. - -- Uses the pkg_resources module if available and no standard file -- found at the calculated location. +@@ -77,23 +77,16 @@ def open_resource(name): + Uses the pkg_resources module if available and no standard file + found at the calculated location. """ ++ _tzinfo_dir = os.getenv("TZDIR") or "/usr/share/zoneinfo" ++ if _tzinfo_dir.endswith(os.sep): ++ _tzinfo_dir = _tzinfo_dir[:-1] ++ name_parts = name.lstrip('/').split('/') for part in name_parts: if part == os.path.pardir or os.path.sep in part: raise ValueError('Bad path segment: %r' % part) - filename = os.path.join(os.path.dirname(__file__), - 'zoneinfo', *name_parts) -- if not os.path.exists(filename) and resource_stream is not None: +- 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. -- return resource_stream(__name__, 'zoneinfo/' + name) +- try: +- 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') -@@ -487,1037 +482,38 @@ def _test(): +@@ -490,1037 +483,38 @@ def _test(): if __name__ == '__main__': _test()