diff options
author | Paul Varner <fuzzyray@gentoo.org> | 2016-06-30 15:39:24 -0500 |
---|---|---|
committer | Paul Varner <fuzzyray@gentoo.org> | 2016-06-30 15:39:24 -0500 |
commit | b72e032ea252757c4309516c865fafaf7354036b (patch) | |
tree | a0011abf57201bd590c7747f4b46548e3dc3e9af | |
parent | eclean: Keep only packages with BUILD_TIME equal to installed one (diff) | |
download | gentoolkit-b72e032e.tar.gz gentoolkit-b72e032e.tar.bz2 gentoolkit-b72e032e.zip |
equery: Fix UnicodeDecodeError in python2.7
This fix explicitly decodes the content of the USE description files as
UTF-8. This fixes the UnicodeDecodeError in Python 2.7. Tested with a
POSIX locale with Python 2.7, 3.4 and 3.5.
X-Gentoo-bug: 587606
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=587606
-rw-r--r-- | pym/gentoolkit/equery/uses.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py index 79ed00f..adf8b6c 100644 --- a/pym/gentoolkit/equery/uses.py +++ b/pym/gentoolkit/equery/uses.py @@ -138,6 +138,7 @@ def get_global_useflags(): path = os.path.join(settings["PORTDIR"], 'profiles', 'use.desc') with open(_unicode_encode(path, encoding=_encodings['fs'])) as open_file: for line in open_file: + line = _unicode_decode(line) if line.startswith('#'): continue # Ex. of fields: ['syslog', 'Enables support for syslog\n'] @@ -158,6 +159,7 @@ def get_global_useflags(): try: with open(_unicode_encode(path, encoding=_encodings['fs'])) as open_file: for line in open_file: + line = _unicode_decode(line) if line.startswith('#'): continue fields = [field.strip() for field in line.split(" - ", 1)] |