python-pytz/system_zoneinfo.patch

45 lines
1.7 KiB
Diff
Raw Normal View History

Index: pytz-2014.9/pytz/__init__.py
===================================================================
--- pytz-2014.9.orig/pytz/__init__.py
+++ pytz-2014.9/pytz/__init__.py
@@ -25,11 +25,6 @@ __all__ = [
import sys, datetime, os.path, gettext
-try:
- from pkg_resources import resource_stream
-except ImportError:
- resource_stream = None
-
from pytz.exceptions import AmbiguousTimeError
from pytz.exceptions import InvalidTimeError
from pytz.exceptions import NonExistentTimeError
@@ -86,13 +81,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)
- filename = os.path.join(os.path.dirname(__file__),
- 'zoneinfo', *name_parts)
- if not os.path.exists(filename) and resource_stream is not None:
- # 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)
+ filename = os.path.join('/usr/share/zoneinfo', *name_parts)
return open(filename, 'rb')
Index: pytz-2014.9/pytz/tzfile.py
===================================================================
--- pytz-2014.9.orig/pytz/tzfile.py
+++ pytz-2014.9/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',