]> granicus.if.org Git - python/commitdiff
Issue #20076: Added non derived UTF-8 aliases to locale aliases table.
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 1 Oct 2014 21:11:21 +0000 (00:11 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 1 Oct 2014 21:11:21 +0000 (00:11 +0300)
The makelocalealias.py script no longer ignores UTF-8 mapping.

1  2 
Misc/NEWS
Tools/i18n/makelocalealias.py

diff --cc Misc/NEWS
index 8e94cdc3290a61e05dba5ec24d403ca402a35c7d,182032afa9a94cf434a24835a043751c2e12a49a..97899c95e307a63d293b149d55dfa61df964d1a9
+++ b/Misc/NEWS
@@@ -156,17 -50,6 +156,19 @@@ Core and Builtin
  Library
  -------
  
++- Issue #20076: Added non derived UTF-8 aliases to locale aliases table.
++
 +- Issue #20079: Added locales supported in glibc 2.18 to locale alias table.
 +
 +- Issue #20218: Added convenience methods read_text/write_text and read_bytes/
 +  write_bytes to pathlib.Path objects.
 +
 +- Issue #22437: Number of capturing groups in regular expression is no longer
 +  limited by 100.
 +
 +- Issue #17442: InteractiveInterpreter now displays the full chained traceback
 +  in its showtraceback method, to match the built in interactive interpreter.
 +
  - Issue #10510: distutils register and upload methods now use HTML standards
    compliant CRLF line endings.
  
@@@ -1188,23 -871,6 +1190,25 @@@ Test
  Tools/Demos
  -----------
  
++- Issue #20076: The makelocalealias.py script no longer ignores UTF-8 mapping.
++
 +- Issue #20079: The makelocalealias.py script now can parse the SUPPORTED file
 +  from glibc sources and supports command line options for source paths.
 +
 +- Issue #22201: Command-line interface of the zipfile module now correctly
 +  extracts ZIP files with directory entries.  Patch by Ryan Wilson.
 +
 +- Issue #22120: For functions using an unsigned integer return converter,
 +  Argument Clinic now generates a cast to that type for the comparison
 +  to -1 in the generated code.  (This supresses a compilation warning.)
 +
 +- Issue #18974: Tools/scripts/diff.py now uses argparse instead of optparse.
 +
 +- Issue #21906: Make Tools/scripts/md5sum.py work in Python 3.
 +  Patch by Zachary Ware.
 +
 +- Issue #21629: Fix Argument Clinic's "--converters" feature.
 +
  - Add support for ``yield from`` to 2to3.
  
  - Add support for the PEP 465 matrix multiplication operator to 2to3.
index ca69daa7a828239d0cfa71a5e2a85da246090620,10887ce338a96e62409c780c29161c96ff3356de..980465b42c9f5636cabc5b89a3c212a9e463f5c1
@@@ -45,41 -44,10 +45,37 @@@ def parse(filename)
              encoding = encoding.replace('-', '')
              encoding = encoding.replace('_', '')
              locale = lang + '.' + encoding
--            if encoding.lower() == 'utf8':
--                # Ignore UTF-8 mappings - this encoding should be
--                # available for all locales
--                continue
 +        data[locale] = alias
 +    return data
 +
 +def parse_glibc_supported(filename):
 +
 +    with open(filename, encoding='latin1') as f:
 +        lines = list(f)
 +    data = {}
 +    for line in lines:
 +        line = line.strip()
 +        if not line:
 +            continue
 +        if line[:1] == '#':
 +            continue
 +        if '/' not in line:
 +            continue
 +        line = line.rstrip('\\').rstrip()
 +        alias, _, alias_encoding = line.partition('/')
 +        # Lower-case locale
 +        locale = alias.lower()
 +        # Normalize encoding, if given
 +        if '.' in locale:
 +            lang, encoding = locale.split('.')[:2]
 +            encoding = encoding.replace('-', '')
 +            encoding = encoding.replace('_', '')
 +            locale = lang + '.' + encoding
 +        # Add an encoding to alias
 +        alias, _, modifier = alias.partition('@')
 +        alias = _locale._replace_encoding(alias, alias_encoding)
 +        if modifier and not (modifier == 'euro' and alias_encoding == 'ISO-8859-15'):
 +            alias += '@' + modifier
          data[locale] = alias
      return data