2017-03-14 13:59:46 +01:00
|
|
|
Index: pytz-2016.10/pytz/__init__.py
|
|
|
|
===================================================================
|
|
|
|
--- pytz-2016.10.orig/pytz/__init__.py
|
|
|
|
+++ pytz-2016.10/pytz/__init__.py
|
2017-11-02 16:25:27 +01:00
|
|
|
@@ -87,23 +87,7 @@ def open_resource(name):
|
2017-03-14 13:59:46 +01:00
|
|
|
for part in name_parts:
|
|
|
|
if part == os.path.pardir or os.path.sep in part:
|
|
|
|
raise ValueError('Bad path segment: %r' % part)
|
2017-11-02 16:25:27 +01:00
|
|
|
- zoneinfo_dir = os.environ.get('PYTZ_TZDATADIR', None)
|
|
|
|
- if zoneinfo_dir != 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
|
2017-03-14 13:59:46 +01:00
|
|
|
-
|
2017-11-02 16:25:27 +01:00
|
|
|
- if resource_stream is not None:
|
|
|
|
- return resource_stream(__name__, 'zoneinfo/' + name)
|
2017-03-14 13:59:46 +01:00
|
|
|
+ filename = os.path.join('/usr/share/zoneinfo', *name_parts)
|
|
|
|
return open(filename, 'rb')
|
|
|
|
|
|
|
|
|
|
|
|
Index: pytz-2016.10/pytz/tzfile.py
|
|
|
|
===================================================================
|
|
|
|
--- pytz-2016.10.orig/pytz/tzfile.py
|
|
|
|
+++ pytz-2016.10/pytz/tzfile.py
|
|
|
|
@@ -127,7 +127,7 @@ def build_tzinfo(zone, fp):
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import os.path
|
|
|
|
from pprint import pprint
|
|
|
|
- base = os.path.join(os.path.dirname(__file__), 'zoneinfo')
|
|
|
|
+ base = '/usr/share/zoneinfo'
|
|
|
|
tz = build_tzinfo('Australia/Melbourne',
|
|
|
|
open(os.path.join(base,'Australia','Melbourne'), 'rb'))
|
|
|
|
tz = build_tzinfo('US/Eastern',
|