components/python/pytz/patches/01-zoneinfopath.patch
changeset 6410 3ae42b2b5dad
parent 3998 5bd484384122
equal deleted inserted replaced
6409:a57c61602ca6 6410:3ae42b2b5dad
       
     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-2016.4/pytz/__init__.py.~1~	2016-05-19 12:19:35.788693592 -0700
       
     7 +++ pytz-2016.4/pytz/__init__.py	2016-05-19 12:42:59.605991654 -0700
       
     8 @@ -86,8 +86,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 @@ -326,13 +325,15 @@
       
    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('UTF-8')
       
    27                  if line.startswith('#'):
       
    28                      continue
       
    29                  code, coordinates, zone = line.split(None, 4)[:3]
       
    30 +                if not code.isupper():
       
    31 +                    continue
       
    32                  if zone not in all_timezones_set:
       
    33                      continue
       
    34                  try:
       
    35 @@ -354,13 +355,15 @@
       
    36      '''
       
    37      def _fill(self):
       
    38          data = {}
       
    39 -        zone_tab = open_resource('iso3166.tab')
       
    40 +        zone_tab = open_resource('tab/country.tab')
       
    41          try:
       
    42              for line in zone_tab.readlines():
       
    43                  line = line.decode('UTF-8')
       
    44                  if line.startswith('#'):
       
    45                      continue
       
    46                  code, name = line.split(None, 1)
       
    47 +                if not code.isupper():
       
    48 +                    continue
       
    49                  data[code] = name.strip()
       
    50              self.data = data
       
    51          finally: