components/python/pytz/patches/zoneinfopath.patch
branchs11-update
changeset 4072 db0cec748ec0
parent 2884 9ad800ee0577
equal deleted inserted replaced
4067:4be1f488dda8 4072:db0cec748ec0
     1 pytz by default ships a private copy of the Olson timezone database, for
     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
     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
     3 point at that copy.  The extra table files are in different places between
     4 the two, so we adjust those paths as well.
     4 the two, so we adjust those paths as well.
     5 
     5 
     6 --- pytz-2013d/pytz/__init__.py	Thu Sep  5 06:42:03 2013
     6 --- pytz-2014.10/pytz/__init__.py.~1~	2014-11-27 01:00:22.000000000 -0800
     7 +++ pytz-2013d/pytz/__init__.py	Tue Oct 22 15:10:47 2013
     7 +++ pytz-2014.10/pytz/__init__.py	2015-02-25 11:05:04.867482331 -0800
     8 @@ -88,8 +88,7 @@
     8 @@ -86,8 +86,7 @@ def open_resource(name):
     9      for part in name_parts:
     9      for part in name_parts:
    10          if part == os.path.pardir or os.path.sep in part:
    10          if part == os.path.pardir or os.path.sep in part:
    11              raise ValueError('Bad path segment: %r' % part)
    11              raise ValueError('Bad path segment: %r' % part)
    12 -    filename = os.path.join(os.path.dirname(__file__),
    12 -    filename = os.path.join(os.path.dirname(__file__),
    13 -                            'zoneinfo', *name_parts)
    13 -                            'zoneinfo', *name_parts)
    14 +    filename = os.path.join('/usr/share/lib/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:
    15      if not os.path.exists(filename) and resource_stream is not None:
    16          # http://bugs.launchpad.net/bugs/383171 - we avoid using this
    16          # http://bugs.launchpad.net/bugs/383171 - we avoid using this
    17          # unless absolutely necessary to help when a broken version of
    17          # unless absolutely necessary to help when a broken version of
    18 @@ -328,7 +327,7 @@
    18 @@ -326,13 +325,15 @@ class _CountryTimezoneDict(LazyDict):
    19  
    19  
    20      def _fill(self):
    20      def _fill(self):
    21          data = {}
    21          data = {}
    22 -        zone_tab = open_resource('zone.tab')
    22 -        zone_tab = open_resource('zone.tab')
    23 +        zone_tab = open_resource('tab/zone_sun.tab')
    23 +        zone_tab = open_resource('tab/zone_sun.tab')
    24          try:
    24          try:
    25              for line in zone_tab:
    25              for line in zone_tab:
    26                  line = line.decode('US-ASCII')
    26                  line = line.decode('US-ASCII')
    27 @@ -335,6 +334,8 @@
       
    28                  if line.startswith('#'):
    27                  if line.startswith('#'):
    29                      continue
    28                      continue
    30                  code, coordinates, zone = line.split(None, 4)[:3]
    29                  code, coordinates, zone = line.split(None, 4)[:3]
    31 +                if not code.isupper():
    30 +                if not code.isupper():
    32 +                    continue
    31 +                    continue
    33                  if zone not in all_timezones_set:
    32                  if zone not in all_timezones_set:
    34                      continue
    33                      continue
    35                  try:
    34                  try:
    36 @@ -356,7 +357,7 @@
    35 @@ -354,13 +355,15 @@ class _CountryNameDict(LazyDict):
    37      '''
    36      '''
    38      def _fill(self):
    37      def _fill(self):
    39          data = {}
    38          data = {}
    40 -        zone_tab = open_resource('iso3166.tab')
    39 -        zone_tab = open_resource('iso3166.tab')
    41 +        zone_tab = open_resource('tab/country.tab')
    40 +        zone_tab = open_resource('tab/country.tab')
    42          try:
    41          try:
    43              for line in zone_tab.readlines():
    42              for line in zone_tab.readlines():
    44                  line = line.decode('US-ASCII')
    43                  line = line.decode('US-ASCII')
    45 @@ -363,6 +364,8 @@
       
    46                  if line.startswith('#'):
    44                  if line.startswith('#'):
    47                      continue
    45                      continue
    48                  code, name = line.split(None, 1)
    46                  code, name = line.split(None, 1)
    49 +                if not code.isupper():
    47 +                if not code.isupper():
    50 +                    continue
    48 +                    continue