diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-09-01 19:10:51 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-09-01 19:10:51 -0700 |
commit | 82562066096bcb3fa57656775aa79bad69bceada (patch) | |
tree | 703ba1a7b93d0b12a74c60a82854a052dc905840 | |
parent | 6feb5a12ed3b501ea5f65dad14d4026105469ad9 (diff) | |
download | portage-82562066096bcb3fa57656775aa79bad69bceada.tar.gz portage-82562066096bcb3fa57656775aa79bad69bceada.tar.bz2 portage-82562066096bcb3fa57656775aa79bad69bceada.zip |
Use utf_8 encoding for merge when ascii is configured.
It probably won't hurt, and forced conversion to ascii encoding is
known to break some packages that install file names with utf_8
encoding (see bug #381509). The ascii aliases are borrowed from
python's encodings.aliases.aliases dict.
-rw-r--r-- | pym/portage/__init__.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 72cdf2dbb..901ea2c96 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -158,9 +158,20 @@ _encodings = { 'stdio' : 'utf_8', } -# This can happen if python is built with USE=build (stage 1). -if _encodings['merge'] is None: - _encodings['merge'] = 'ascii' +# sys.getfilesystemencoding() can return None if python is built with +# USE=build (stage 1). If the filesystem encoding is undefined or is a +# subset of utf_8, then we default to utf_8 encoding for merges, since +# it probably won't hurt, and forced conversion to ascii encoding is +# known to break some packages that install file names with utf_8 +# encoding (see bug #381509). The ascii aliases are borrowed from +# python's encodings.aliases.aliases dict. +if _encodings['merge'] is None or \ + _encodings['merge'].lower().replace('-', '_') in \ + ('ascii', '646', 'ansi_x3.4_1968', 'ansi_x3_4_1968', + 'ansi_x3.4_1986', 'cp367', 'csascii', 'ibm367', 'iso646_us', + 'iso_646.irv_1991', 'iso_ir_6', 'us', 'us_ascii'): + + _encodings['merge'] = 'utf_8' if sys.hexversion >= 0x3000000: def _unicode_encode(s, encoding=_encodings['content'], errors='backslashreplace'): |