Fix patch
This commit is contained in:
parent
40029e8aa9
commit
e6a0d42125
@ -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
|
||||
@@ -77,23 +77,16 @@ def open_resource(name):
|
||||
Uses the pkg_resources module if available and no standard file
|
||||
found at the calculated location.
|
||||
"""
|
||||
return s.encode('US-ASCII')
|
||||
|
||||
+_tzinfo_dir = os.getenv("TZDIR") or "/usr/share/zoneinfo"
|
||||
+if _tzinfo_dir.endswith(os.sep):
|
||||
+ _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.
|
||||
"""
|
||||
+
|
||||
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.
|
||||
- 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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user