1 diff -up python-dateutil-1.5/dateutil/zoneinfo/__init__.py\~ python-dateutil-1.5/dateutil/zoneinfo/__init__.py
2 --- python-dateutil-1.5/dateutil/zoneinfo/__init__.py~ 2005-12-22 19:13:50.000000000 +0100
3 +++ python-dateutil-1.5/dateutil/zoneinfo/__init__.py 2011-08-17 15:24:29.019214748 +0200
4 @@ -15,6 +15,7 @@ __all__ = ["setcachesize", "gettz", "reb
8 +USE_SYSTEM_ZONEINFO = True # XXX configure at build time
12 @@ -29,7 +30,8 @@ def getzoneinfofile():
13 return os.path.join(os.path.dirname(__file__), entry)
16 -ZONEINFOFILE = getzoneinfofile()
17 +ZONEINFOFILE = getzoneinfofile() if USE_SYSTEM_ZONEINFO else None
18 +ZONEINFODIR = (os.getenv("TZDIR") or "/usr/share/zoneinfo").rstrip(os.sep)
22 @@ -39,22 +40,37 @@ def setcachesize(size):
28 - for cachedname, tzinfo in CACHE:
29 - if cachedname == name:
31 + for cachedname, tzinfo in CACHE:
32 + if cachedname == name:
35 + name_parts = name.lstrip('/').split('/')
36 + for part in name_parts:
37 + if part == os.path.pardir or os.path.sep in part:
38 + raise ValueError('Bad path segment: %r' % part)
39 + filename = os.path.join(ZONEINFODIR, *name_parts)
41 + zonefile = open(filename, "rb")
45 + tzinfo = tzfile(zonefile)
48 + if tzinfo is None and ZONEINFOFILE:
49 + tf = TarFile.open(ZONEINFOFILE)
51 + zonefile = tf.extractfile(name)
55 - tf = TarFile.open(ZONEINFOFILE)
57 - zonefile = tf.extractfile(name)
61 - tzinfo = tzfile(zonefile)
63 - CACHE.insert(0, (name, tzinfo))
64 - del CACHE[CACHESIZE:]
65 + tzinfo = tzfile(zonefile)
68 + if tzinfo is not None:
69 + CACHE.insert(0, (name, tzinfo))
70 + del CACHE[CACHESIZE:]
74 def rebuild(filename, tag=None, format="gz"):
75 --- python-dateutil-2.2/setup.py.orig 2013-11-01 09:32:03.000000000 +0100
76 +++ python-dateutil-2.2/setup.py 2014-10-19 16:56:34.244854176 +0200
78 VERSION = re.search('__version__ = "([^"]+)"',
79 codecs.open(TOPDIR + "/dateutil/__init__.py", encoding='utf-8').read()).group(1)
81 +# XXX We would like to bind this to something like
82 +# --system-zoneinfo=/path/to/zoneinfo. Any way of doing this short of
83 +# overriding build and install commands?
85 + extra_options = dict(
86 + package_data={"": ["*.tar.gz"]},
92 setup(name="python-dateutil",
95 datetime module available in the Python standard library.
97 packages = ["dateutil", "dateutil.zoneinfo"],
98 - package_data = {"": ["*.tar.gz"]},
99 include_package_data = True,
103 'Programming Language :: Python :: 3.2',
104 'Programming Language :: Python :: 3.3',
105 'Topic :: Software Development :: Libraries',