python-dateutil 2.4.1__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python-dateutil-2.4.1/LICENSE +31 -0
- python-dateutil-2.4.1/MANIFEST.in +1 -0
- python-dateutil-2.4.1/NEWS +219 -0
- python-dateutil-2.4.1/PKG-INFO +26 -0
- python-dateutil-2.4.1/README.rst +124 -0
- python-dateutil-2.4.1/dateutil/__init__.py +2 -0
- python-dateutil-2.4.1/dateutil/easter.py +89 -0
- python-dateutil-2.4.1/dateutil/parser.py +1174 -0
- python-dateutil-2.4.1/dateutil/relativedelta.py +450 -0
- python-dateutil-2.4.1/dateutil/rrule.py +1375 -0
- python-dateutil-2.4.1/dateutil/test/__init__.py +0 -0
- python-dateutil-2.4.1/dateutil/test/test.py +4108 -0
- python-dateutil-2.4.1/dateutil/tz.py +986 -0
- python-dateutil-2.4.1/dateutil/tzwin.py +184 -0
- python-dateutil-2.4.1/dateutil/zoneinfo/__init__.py +108 -0
- python-dateutil-2.4.1/dateutil/zoneinfo/dateutil-zoneinfo.tar.gz +0 -0
- python-dateutil-2.4.1/python_dateutil.egg-info/PKG-INFO +26 -0
- python-dateutil-2.4.1/python_dateutil.egg-info/SOURCES.txt +25 -0
- python-dateutil-2.4.1/python_dateutil.egg-info/dependency_links.txt +1 -0
- python-dateutil-2.4.1/python_dateutil.egg-info/requires.txt +1 -0
- python-dateutil-2.4.1/python_dateutil.egg-info/top_level.txt +1 -0
- python-dateutil-2.4.1/python_dateutil.egg-info/zip-safe +1 -0
- python-dateutil-2.4.1/setup.cfg +8 -0
- python-dateutil-2.4.1/setup.py +51 -0
- python-dateutil-2.4.1/updatezinfo.py +33 -0
- python-dateutil-2.4.1/zonefile_metadata.json +21 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# This code was originally contributed by Jeffrey Harris.
|
|
2
|
+
import datetime
|
|
3
|
+
import struct
|
|
4
|
+
|
|
5
|
+
from six.moves import winreg
|
|
6
|
+
|
|
7
|
+
__all__ = ["tzwin", "tzwinlocal"]
|
|
8
|
+
|
|
9
|
+
ONEWEEK = datetime.timedelta(7)
|
|
10
|
+
|
|
11
|
+
TZKEYNAMENT = r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"
|
|
12
|
+
TZKEYNAME9X = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Time Zones"
|
|
13
|
+
TZLOCALKEYNAME = r"SYSTEM\CurrentControlSet\Control\TimeZoneInformation"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _settzkeyname():
|
|
17
|
+
handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
|
|
18
|
+
try:
|
|
19
|
+
winreg.OpenKey(handle, TZKEYNAMENT).Close()
|
|
20
|
+
TZKEYNAME = TZKEYNAMENT
|
|
21
|
+
except WindowsError:
|
|
22
|
+
TZKEYNAME = TZKEYNAME9X
|
|
23
|
+
handle.Close()
|
|
24
|
+
return TZKEYNAME
|
|
25
|
+
|
|
26
|
+
TZKEYNAME = _settzkeyname()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class tzwinbase(datetime.tzinfo):
|
|
30
|
+
"""tzinfo class based on win32's timezones available in the registry."""
|
|
31
|
+
|
|
32
|
+
def utcoffset(self, dt):
|
|
33
|
+
if self._isdst(dt):
|
|
34
|
+
return datetime.timedelta(minutes=self._dstoffset)
|
|
35
|
+
else:
|
|
36
|
+
return datetime.timedelta(minutes=self._stdoffset)
|
|
37
|
+
|
|
38
|
+
def dst(self, dt):
|
|
39
|
+
if self._isdst(dt):
|
|
40
|
+
minutes = self._dstoffset - self._stdoffset
|
|
41
|
+
return datetime.timedelta(minutes=minutes)
|
|
42
|
+
else:
|
|
43
|
+
return datetime.timedelta(0)
|
|
44
|
+
|
|
45
|
+
def tzname(self, dt):
|
|
46
|
+
if self._isdst(dt):
|
|
47
|
+
return self._dstname
|
|
48
|
+
else:
|
|
49
|
+
return self._stdname
|
|
50
|
+
|
|
51
|
+
def list():
|
|
52
|
+
"""Return a list of all time zones known to the system."""
|
|
53
|
+
handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
|
|
54
|
+
tzkey = winreg.OpenKey(handle, TZKEYNAME)
|
|
55
|
+
result = [winreg.EnumKey(tzkey, i)
|
|
56
|
+
for i in range(winreg.QueryInfoKey(tzkey)[0])]
|
|
57
|
+
tzkey.Close()
|
|
58
|
+
handle.Close()
|
|
59
|
+
return result
|
|
60
|
+
list = staticmethod(list)
|
|
61
|
+
|
|
62
|
+
def display(self):
|
|
63
|
+
return self._display
|
|
64
|
+
|
|
65
|
+
def _isdst(self, dt):
|
|
66
|
+
if not self._dstmonth:
|
|
67
|
+
# dstmonth == 0 signals the zone has no daylight saving time
|
|
68
|
+
return False
|
|
69
|
+
dston = picknthweekday(dt.year, self._dstmonth, self._dstdayofweek,
|
|
70
|
+
self._dsthour, self._dstminute,
|
|
71
|
+
self._dstweeknumber)
|
|
72
|
+
dstoff = picknthweekday(dt.year, self._stdmonth, self._stddayofweek,
|
|
73
|
+
self._stdhour, self._stdminute,
|
|
74
|
+
self._stdweeknumber)
|
|
75
|
+
if dston < dstoff:
|
|
76
|
+
return dston <= dt.replace(tzinfo=None) < dstoff
|
|
77
|
+
else:
|
|
78
|
+
return not dstoff <= dt.replace(tzinfo=None) < dston
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class tzwin(tzwinbase):
|
|
82
|
+
|
|
83
|
+
def __init__(self, name):
|
|
84
|
+
self._name = name
|
|
85
|
+
|
|
86
|
+
# multiple contexts only possible in 2.7 and 3.1, we still support 2.6
|
|
87
|
+
with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as handle:
|
|
88
|
+
with winreg.OpenKey(handle,
|
|
89
|
+
"%s\%s" % (TZKEYNAME, name)) as tzkey:
|
|
90
|
+
keydict = valuestodict(tzkey)
|
|
91
|
+
|
|
92
|
+
self._stdname = keydict["Std"].encode("iso-8859-1")
|
|
93
|
+
self._dstname = keydict["Dlt"].encode("iso-8859-1")
|
|
94
|
+
|
|
95
|
+
self._display = keydict["Display"]
|
|
96
|
+
|
|
97
|
+
# See http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm
|
|
98
|
+
tup = struct.unpack("=3l16h", keydict["TZI"])
|
|
99
|
+
self._stdoffset = -tup[0]-tup[1] # Bias + StandardBias * -1
|
|
100
|
+
self._dstoffset = self._stdoffset-tup[2] # + DaylightBias * -1
|
|
101
|
+
|
|
102
|
+
# for the meaning see the win32 TIME_ZONE_INFORMATION structure docs
|
|
103
|
+
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms725481(v=vs.85).aspx
|
|
104
|
+
(self._stdmonth,
|
|
105
|
+
self._stddayofweek, # Sunday = 0
|
|
106
|
+
self._stdweeknumber, # Last = 5
|
|
107
|
+
self._stdhour,
|
|
108
|
+
self._stdminute) = tup[4:9]
|
|
109
|
+
|
|
110
|
+
(self._dstmonth,
|
|
111
|
+
self._dstdayofweek, # Sunday = 0
|
|
112
|
+
self._dstweeknumber, # Last = 5
|
|
113
|
+
self._dsthour,
|
|
114
|
+
self._dstminute) = tup[12:17]
|
|
115
|
+
|
|
116
|
+
def __repr__(self):
|
|
117
|
+
return "tzwin(%s)" % repr(self._name)
|
|
118
|
+
|
|
119
|
+
def __reduce__(self):
|
|
120
|
+
return (self.__class__, (self._name,))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class tzwinlocal(tzwinbase):
|
|
124
|
+
|
|
125
|
+
def __init__(self):
|
|
126
|
+
|
|
127
|
+
with winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) as handle:
|
|
128
|
+
|
|
129
|
+
with winreg.OpenKey(handle, TZLOCALKEYNAME) as tzlocalkey:
|
|
130
|
+
keydict = valuestodict(tzlocalkey)
|
|
131
|
+
|
|
132
|
+
self._stdname = keydict["StandardName"].encode("iso-8859-1")
|
|
133
|
+
self._dstname = keydict["DaylightName"].encode("iso-8859-1")
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
with winreg.OpenKey(
|
|
137
|
+
handle, "%s\%s" % (TZKEYNAME, self._stdname)) as tzkey:
|
|
138
|
+
_keydict = valuestodict(tzkey)
|
|
139
|
+
self._display = _keydict["Display"]
|
|
140
|
+
except OSError:
|
|
141
|
+
self._display = None
|
|
142
|
+
|
|
143
|
+
self._stdoffset = -keydict["Bias"]-keydict["StandardBias"]
|
|
144
|
+
self._dstoffset = self._stdoffset-keydict["DaylightBias"]
|
|
145
|
+
|
|
146
|
+
# See http://ww_winreg.jsiinc.com/SUBA/tip0300/rh0398.htm
|
|
147
|
+
tup = struct.unpack("=8h", keydict["StandardStart"])
|
|
148
|
+
|
|
149
|
+
(self._stdmonth,
|
|
150
|
+
self._stddayofweek, # Sunday = 0
|
|
151
|
+
self._stdweeknumber, # Last = 5
|
|
152
|
+
self._stdhour,
|
|
153
|
+
self._stdminute) = tup[1:6]
|
|
154
|
+
|
|
155
|
+
tup = struct.unpack("=8h", keydict["DaylightStart"])
|
|
156
|
+
|
|
157
|
+
(self._dstmonth,
|
|
158
|
+
self._dstdayofweek, # Sunday = 0
|
|
159
|
+
self._dstweeknumber, # Last = 5
|
|
160
|
+
self._dsthour,
|
|
161
|
+
self._dstminute) = tup[1:6]
|
|
162
|
+
|
|
163
|
+
def __reduce__(self):
|
|
164
|
+
return (self.__class__, ())
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def picknthweekday(year, month, dayofweek, hour, minute, whichweek):
|
|
168
|
+
"""dayofweek == 0 means Sunday, whichweek 5 means last instance"""
|
|
169
|
+
first = datetime.datetime(year, month, 1, hour, minute)
|
|
170
|
+
weekdayone = first.replace(day=((dayofweek-first.isoweekday()) % 7+1))
|
|
171
|
+
for n in range(whichweek):
|
|
172
|
+
dt = weekdayone+(whichweek-n)*ONEWEEK
|
|
173
|
+
if dt.month == month:
|
|
174
|
+
return dt
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def valuestodict(key):
|
|
178
|
+
"""Convert a registry key's values to a dictionary."""
|
|
179
|
+
dict = {}
|
|
180
|
+
size = winreg.QueryInfoKey(key)[1]
|
|
181
|
+
for i in range(size):
|
|
182
|
+
data = winreg.EnumValue(key, i)
|
|
183
|
+
dict[data[0]] = data[1]
|
|
184
|
+
return dict
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import warnings
|
|
5
|
+
import tempfile
|
|
6
|
+
import shutil
|
|
7
|
+
from subprocess import check_call
|
|
8
|
+
from tarfile import TarFile
|
|
9
|
+
from pkgutil import get_data
|
|
10
|
+
from io import BytesIO
|
|
11
|
+
from contextlib import closing
|
|
12
|
+
|
|
13
|
+
from dateutil.tz import tzfile
|
|
14
|
+
|
|
15
|
+
__all__ = ["setcachesize", "gettz", "rebuild"]
|
|
16
|
+
|
|
17
|
+
_ZONEFILENAME = "dateutil-zoneinfo.tar.gz"
|
|
18
|
+
|
|
19
|
+
# python2.6 compatability. Note that TarFile.__exit__ != TarFile.close, but
|
|
20
|
+
# it's close enough for python2.6
|
|
21
|
+
_tar_open = TarFile.open
|
|
22
|
+
if not hasattr(TarFile, '__exit__'):
|
|
23
|
+
def _tar_open(*args, **kwargs):
|
|
24
|
+
return closing(TarFile.open(*args, **kwargs))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class tzfile(tzfile):
|
|
28
|
+
def __reduce__(self):
|
|
29
|
+
return (gettz, (self._filename,))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def getzoneinfofile_stream():
|
|
33
|
+
try:
|
|
34
|
+
return BytesIO(get_data(__name__, _ZONEFILENAME))
|
|
35
|
+
except IOError as e: # TODO switch to FileNotFoundError?
|
|
36
|
+
warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))
|
|
37
|
+
return None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ZoneInfoFile(object):
|
|
41
|
+
def __init__(self, zonefile_stream=None):
|
|
42
|
+
if zonefile_stream is not None:
|
|
43
|
+
with _tar_open(fileobj=zonefile_stream, mode='r') as tf:
|
|
44
|
+
# dict comprehension does not work on python2.6
|
|
45
|
+
# TODO: get back to the nicer syntax when we ditch python2.6
|
|
46
|
+
# self.zones = {zf.name: tzfile(tf.extractfile(zf),
|
|
47
|
+
# filename = zf.name)
|
|
48
|
+
# for zf in tf.getmembers() if zf.isfile()}
|
|
49
|
+
self.zones = dict((zf.name, tzfile(tf.extractfile(zf),
|
|
50
|
+
filename=zf.name))
|
|
51
|
+
for zf in tf.getmembers() if zf.isfile())
|
|
52
|
+
# deal with links: They'll point to their parent object. Less
|
|
53
|
+
# waste of memory
|
|
54
|
+
# links = {zl.name: self.zones[zl.linkname]
|
|
55
|
+
# for zl in tf.getmembers() if zl.islnk() or zl.issym()}
|
|
56
|
+
links = dict((zl.name, self.zones[zl.linkname])
|
|
57
|
+
for zl in tf.getmembers() if
|
|
58
|
+
zl.islnk() or zl.issym())
|
|
59
|
+
self.zones.update(links)
|
|
60
|
+
else:
|
|
61
|
+
self.zones = dict()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# The current API has gettz as a module function, although in fact it taps into
|
|
65
|
+
# a stateful class. So as a workaround for now, without changing the API, we
|
|
66
|
+
# will create a new "global" class instance the first time a user requests a
|
|
67
|
+
# timezone. Ugly, but adheres to the api.
|
|
68
|
+
#
|
|
69
|
+
# TODO: deprecate this.
|
|
70
|
+
_CLASS_ZONE_INSTANCE = list()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def gettz(name):
|
|
74
|
+
if len(_CLASS_ZONE_INSTANCE) == 0:
|
|
75
|
+
_CLASS_ZONE_INSTANCE.append(ZoneInfoFile(getzoneinfofile_stream()))
|
|
76
|
+
return _CLASS_ZONE_INSTANCE[0].zones.get(name)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def rebuild(filename, tag=None, format="gz", zonegroups=[]):
|
|
80
|
+
"""Rebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar*
|
|
81
|
+
|
|
82
|
+
filename is the timezone tarball from ftp.iana.org/tz.
|
|
83
|
+
|
|
84
|
+
"""
|
|
85
|
+
tmpdir = tempfile.mkdtemp()
|
|
86
|
+
zonedir = os.path.join(tmpdir, "zoneinfo")
|
|
87
|
+
moduledir = os.path.dirname(__file__)
|
|
88
|
+
try:
|
|
89
|
+
with _tar_open(filename) as tf:
|
|
90
|
+
for name in zonegroups:
|
|
91
|
+
tf.extract(name, tmpdir)
|
|
92
|
+
filepaths = [os.path.join(tmpdir, n) for n in zonegroups]
|
|
93
|
+
try:
|
|
94
|
+
check_call(["zic", "-d", zonedir] + filepaths)
|
|
95
|
+
except OSError as e:
|
|
96
|
+
if e.errno == 2:
|
|
97
|
+
logging.error(
|
|
98
|
+
"Could not find zic. Perhaps you need to install "
|
|
99
|
+
"libc-bin or some other package that provides it, "
|
|
100
|
+
"or it's not in your PATH?")
|
|
101
|
+
raise
|
|
102
|
+
target = os.path.join(moduledir, _ZONEFILENAME)
|
|
103
|
+
with _tar_open(target, "w:%s" % format) as tf:
|
|
104
|
+
for entry in os.listdir(zonedir):
|
|
105
|
+
entrypath = os.path.join(zonedir, entry)
|
|
106
|
+
tf.add(entrypath, entry)
|
|
107
|
+
finally:
|
|
108
|
+
shutil.rmtree(tmpdir)
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 1.1
|
|
2
|
+
Name: python-dateutil
|
|
3
|
+
Version: 2.4.1
|
|
4
|
+
Summary: Extensions to the standard Python datetime module
|
|
5
|
+
Home-page: https://dateutil.readthedocs.org
|
|
6
|
+
Author: Yaron de Leeuw
|
|
7
|
+
Author-email: me@jarondl.net
|
|
8
|
+
License: Simplified BSD
|
|
9
|
+
Description:
|
|
10
|
+
The dateutil module provides powerful extensions to the
|
|
11
|
+
datetime module available in the Python standard library.
|
|
12
|
+
|
|
13
|
+
Platform: UNKNOWN
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 2
|
|
19
|
+
Classifier: Programming Language :: Python :: 2.6
|
|
20
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.2
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.3
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.4
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
26
|
+
Requires: six
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
NEWS
|
|
4
|
+
README.rst
|
|
5
|
+
setup.cfg
|
|
6
|
+
setup.py
|
|
7
|
+
updatezinfo.py
|
|
8
|
+
zonefile_metadata.json
|
|
9
|
+
dateutil/__init__.py
|
|
10
|
+
dateutil/easter.py
|
|
11
|
+
dateutil/parser.py
|
|
12
|
+
dateutil/relativedelta.py
|
|
13
|
+
dateutil/rrule.py
|
|
14
|
+
dateutil/tz.py
|
|
15
|
+
dateutil/tzwin.py
|
|
16
|
+
dateutil/test/__init__.py
|
|
17
|
+
dateutil/test/test.py
|
|
18
|
+
dateutil/zoneinfo/__init__.py
|
|
19
|
+
dateutil/zoneinfo/dateutil-zoneinfo.tar.gz
|
|
20
|
+
python_dateutil.egg-info/PKG-INFO
|
|
21
|
+
python_dateutil.egg-info/SOURCES.txt
|
|
22
|
+
python_dateutil.egg-info/dependency_links.txt
|
|
23
|
+
python_dateutil.egg-info/requires.txt
|
|
24
|
+
python_dateutil.egg-info/top_level.txt
|
|
25
|
+
python_dateutil.egg-info/zip-safe
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
six >=1.5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dateutil
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
from os.path import isfile
|
|
3
|
+
import codecs
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
from setuptools import setup
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if isfile("MANIFEST"):
|
|
11
|
+
os.unlink("MANIFEST")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
TOPDIR = os.path.dirname(__file__) or "."
|
|
15
|
+
VERSION = re.search('__version__ = "([^"]+)"',
|
|
16
|
+
codecs.open(TOPDIR + "/dateutil/__init__.py",
|
|
17
|
+
encoding='utf-8').read()).group(1)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
setup(name="python-dateutil",
|
|
21
|
+
version=VERSION,
|
|
22
|
+
description="Extensions to the standard Python datetime module",
|
|
23
|
+
author="Yaron de Leeuw",
|
|
24
|
+
author_email="me@jarondl.net",
|
|
25
|
+
url="https://dateutil.readthedocs.org",
|
|
26
|
+
license="Simplified BSD",
|
|
27
|
+
long_description="""
|
|
28
|
+
The dateutil module provides powerful extensions to the
|
|
29
|
+
datetime module available in the Python standard library.
|
|
30
|
+
""",
|
|
31
|
+
packages=["dateutil", "dateutil.zoneinfo"],
|
|
32
|
+
package_data={"dateutil.zoneinfo": ["dateutil-zoneinfo.tar.gz"]},
|
|
33
|
+
zip_safe=True,
|
|
34
|
+
requires=["six"],
|
|
35
|
+
install_requires=["six >=1.5"], # XXX fix when packaging is sane again
|
|
36
|
+
classifiers=[
|
|
37
|
+
'Development Status :: 5 - Production/Stable',
|
|
38
|
+
'Intended Audience :: Developers',
|
|
39
|
+
'License :: OSI Approved :: BSD License',
|
|
40
|
+
'Programming Language :: Python',
|
|
41
|
+
'Programming Language :: Python :: 2',
|
|
42
|
+
'Programming Language :: Python :: 2.6',
|
|
43
|
+
'Programming Language :: Python :: 2.7',
|
|
44
|
+
'Programming Language :: Python :: 3',
|
|
45
|
+
'Programming Language :: Python :: 3.2',
|
|
46
|
+
'Programming Language :: Python :: 3.3',
|
|
47
|
+
'Programming Language :: Python :: 3.4',
|
|
48
|
+
'Topic :: Software Development :: Libraries',
|
|
49
|
+
],
|
|
50
|
+
test_suite="dateutil.test.test"
|
|
51
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import os
|
|
3
|
+
import hashlib
|
|
4
|
+
import json
|
|
5
|
+
import io
|
|
6
|
+
|
|
7
|
+
from six.moves.urllib import request
|
|
8
|
+
|
|
9
|
+
from dateutil.zoneinfo import rebuild
|
|
10
|
+
|
|
11
|
+
METADATA_FILE = "zonefile_metadata.json"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def main():
|
|
15
|
+
with io.open(METADATA_FILE, 'r') as f:
|
|
16
|
+
metadata = json.load(f)
|
|
17
|
+
|
|
18
|
+
if not os.path.isfile(metadata['tzdata_file']):
|
|
19
|
+
print("Downloading tz file from iana")
|
|
20
|
+
request.urlretrieve(os.path.join(metadata['releases_url'],
|
|
21
|
+
metadata['tzdata_file']),
|
|
22
|
+
metadata['tzdata_file'])
|
|
23
|
+
with open(metadata['tzdata_file'], 'rb') as tzfile:
|
|
24
|
+
sha_hasher = hashlib.sha512()
|
|
25
|
+
sha_hasher.update(tzfile.read())
|
|
26
|
+
sha_512_file = sha_hasher.hexdigest()
|
|
27
|
+
assert metadata['tzdata_file_sha512'] == sha_512_file, "SHA failed for"
|
|
28
|
+
print("Updating timezone information...")
|
|
29
|
+
rebuild(metadata['tzdata_file'], zonegroups=metadata['zonegroups'])
|
|
30
|
+
print("Done.")
|
|
31
|
+
|
|
32
|
+
if __name__ == "__main__":
|
|
33
|
+
main()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata_version" : 0.1,
|
|
3
|
+
"releases_url" : "ftp://ftp.iana.org/tz/releases/",
|
|
4
|
+
"tzdata_file" : "tzdata2015a.tar.gz",
|
|
5
|
+
"tzdata_file_sha512" : "ff36feb437238ba42fe67257e81ade0a2179d11f6c6449146e28e4b6553c62348b4131af75e440b4467109c9edba13e25ddaf701f2fcebb2a258b4ac9b57293c",
|
|
6
|
+
"zonegroups" : [
|
|
7
|
+
"africa",
|
|
8
|
+
"antarctica",
|
|
9
|
+
"asia",
|
|
10
|
+
"australasia",
|
|
11
|
+
"europe",
|
|
12
|
+
"northamerica",
|
|
13
|
+
"southamerica",
|
|
14
|
+
"pacificnew",
|
|
15
|
+
"etcetera",
|
|
16
|
+
"systemv",
|
|
17
|
+
"factory",
|
|
18
|
+
"backzone",
|
|
19
|
+
"backward"]
|
|
20
|
+
}
|
|
21
|
+
|