File: tzdata

package info (click to toggle)
python-tz 2012c-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,260 kB
  • sloc: python: 2,509; makefile: 26
file content (55 lines) | stat: -rw-r--r-- 2,379 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
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

Index: pytz-2011h/pytz/__init__.py
===================================================================
--- pytz-2011h.orig/pytz/__init__.py	2011-10-21 15:14:54.048406509 +0900
+++ pytz-2011h/pytz/__init__.py	2011-10-21 15:14:57.232406629 +0900
@@ -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: pytz-2011h/pytz/tzfile.py
===================================================================
--- pytz-2011h.orig/pytz/tzfile.py	2011-06-27 22:48:49.000000000 +0900
+++ pytz-2011h/pytz/tzfile.py	2011-10-21 15:16:11.116409439 +0900
@@ -125,7 +125,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',