components/python/pytz/patches/zoneinfopath.patch
branchs11-update
changeset 2884 9ad800ee0577
child 3998 5bd484384122
equal deleted inserted replaced
2882:09270bc18a9e 2884:9ad800ee0577
       
     1 pytz by default ships a private copy of the Olson timezone database, for
       
     2 operating systems that don't ship their own.  Since Solaris does, we should
       
     3 point at that copy.  The extra table files are in different places between
       
     4 the two, so we adjust those paths as well.
       
     5 
       
     6 --- pytz-2013d/pytz/__init__.py	Thu Sep  5 06:42:03 2013
       
     7 +++ pytz-2013d/pytz/__init__.py	Tue Oct 22 15:10:47 2013
       
     8 @@ -88,8 +88,7 @@
       
     9      for part in name_parts:
       
    10          if part == os.path.pardir or os.path.sep in part:
       
    11              raise ValueError('Bad path segment: %r' % part)
       
    12 -    filename = os.path.join(os.path.dirname(__file__),
       
    13 -                            'zoneinfo', *name_parts)
       
    14 +    filename = os.path.join('/usr/share/lib/zoneinfo', *name_parts)
       
    15      if not os.path.exists(filename) and resource_stream is not None:
       
    16          # http://bugs.launchpad.net/bugs/383171 - we avoid using this
       
    17          # unless absolutely necessary to help when a broken version of
       
    18 @@ -328,7 +327,7 @@
       
    19  
       
    20      def _fill(self):
       
    21          data = {}
       
    22 -        zone_tab = open_resource('zone.tab')
       
    23 +        zone_tab = open_resource('tab/zone_sun.tab')
       
    24          try:
       
    25              for line in zone_tab:
       
    26                  line = line.decode('US-ASCII')
       
    27 @@ -335,6 +334,8 @@
       
    28                  if line.startswith('#'):
       
    29                      continue
       
    30                  code, coordinates, zone = line.split(None, 4)[:3]
       
    31 +                if not code.isupper():
       
    32 +                    continue
       
    33                  if zone not in all_timezones_set:
       
    34                      continue
       
    35                  try:
       
    36 @@ -356,7 +357,7 @@
       
    37      '''
       
    38      def _fill(self):
       
    39          data = {}
       
    40 -        zone_tab = open_resource('iso3166.tab')
       
    41 +        zone_tab = open_resource('tab/country.tab')
       
    42          try:
       
    43              for line in zone_tab.readlines():
       
    44                  line = line.decode('US-ASCII')
       
    45 @@ -363,6 +364,8 @@
       
    46                  if line.startswith('#'):
       
    47                      continue
       
    48                  code, name = line.split(None, 1)
       
    49 +                if not code.isupper():
       
    50 +                    continue
       
    51                  data[code] = name.strip()
       
    52              self.data = data
       
    53          finally: