File: tzdata

package info (click to toggle)
python-tz 2012c%2Bdfsg-0.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 348 kB
  • ctags: 408
  • sloc: python: 2,504; makefile: 25
file content (76 lines) | stat: -rw-r--r-- 3,263 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Description: Use system zone information from the tzdata package
Author: Kurt Roeckx <kurt@roeckx.be>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=416202
Forwarded: not-needed
Last-Update: 2014-11-12

Index: python-tz-2012c+dfsg/pytz/__init__.py
===================================================================
--- python-tz-2012c+dfsg.orig/pytz/__init__.py	2012-04-16 06:42:39.000000000 +0200
+++ python-tz-2012c+dfsg/pytz/__init__.py	2014-11-12 22:11:59.000000000 +0100
@@ -31,11 +31,6 @@
 except ImportError:
     from collections import Mapping as DictMixin
 
-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
@@ -87,17 +82,12 @@
     Uses the pkg_resources module if available and no standard file
     found at the calculated location.
     """
+    # Patched in Debian, use the system zoneinfo from the tzdata package
     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:
-        # 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: python-tz-2012c+dfsg/pytz/tzfile.py
===================================================================
--- python-tz-2012c+dfsg.orig/pytz/tzfile.py	2012-04-16 06:42:39.000000000 +0200
+++ python-tz-2012c+dfsg/pytz/tzfile.py	2014-11-12 22:11:59.000000000 +0100
@@ -127,7 +127,8 @@
 if __name__ == '__main__':
     import os.path
     from pprint import pprint
-    base = os.path.join(os.path.dirname(__file__), 'zoneinfo')
+    # Patched in Debian, use the system zoninfo from the tzdata package
+    base = '/usr/share/zoneinfo'
     tz = build_tzinfo('Australia/Melbourne',
                       open(os.path.join(base,'Australia','Melbourne'), 'rb'))
     tz = build_tzinfo('US/Eastern',
Index: python-tz-2012c+dfsg/setup.py
===================================================================
--- python-tz-2012c+dfsg.orig/setup.py	2012-04-16 06:42:39.000000000 +0200
+++ python-tz-2012c+dfsg/setup.py	2014-11-12 22:42:37.000000000 +0100
@@ -13,15 +13,8 @@
 memail = 'stuart@stuartbishop.net'
 packages = ['pytz']
 resources = ['zone.tab', 'locales/pytz.pot']
-for dirpath, dirnames, filenames in os.walk(os.path.join('pytz', 'zoneinfo')):
-    # remove the 'pytz' part of the path
-    basepath = dirpath.split(os.path.sep, 1)[1]
-    resources.extend([os.path.join(basepath, filename)
-                     for filename in filenames])
 package_data = {'pytz': resources}
 
-assert len(resources) > 10, 'zoneinfo files not found!'
-
 setup (
     name='pytz',
     version=pytz.VERSION,