1 |
commit: b72e032ea252757c4309516c865fafaf7354036b |
2 |
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jun 30 20:39:24 2016 +0000 |
4 |
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 30 20:39:24 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b72e032e |
7 |
|
8 |
equery: Fix UnicodeDecodeError in python2.7 |
9 |
|
10 |
This fix explicitly decodes the content of the USE description files as |
11 |
UTF-8. This fixes the UnicodeDecodeError in Python 2.7. Tested with a |
12 |
POSIX locale with Python 2.7, 3.4 and 3.5. |
13 |
|
14 |
X-Gentoo-bug: 587606 |
15 |
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=587606 |
16 |
|
17 |
pym/gentoolkit/equery/uses.py | 2 ++ |
18 |
1 file changed, 2 insertions(+) |
19 |
|
20 |
diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py |
21 |
index 79ed00f..adf8b6c 100644 |
22 |
--- a/pym/gentoolkit/equery/uses.py |
23 |
+++ b/pym/gentoolkit/equery/uses.py |
24 |
@@ -138,6 +138,7 @@ def get_global_useflags(): |
25 |
path = os.path.join(settings["PORTDIR"], 'profiles', 'use.desc') |
26 |
with open(_unicode_encode(path, encoding=_encodings['fs'])) as open_file: |
27 |
for line in open_file: |
28 |
+ line = _unicode_decode(line) |
29 |
if line.startswith('#'): |
30 |
continue |
31 |
# Ex. of fields: ['syslog', 'Enables support for syslog\n'] |
32 |
@@ -158,6 +159,7 @@ def get_global_useflags(): |
33 |
try: |
34 |
with open(_unicode_encode(path, encoding=_encodings['fs'])) as open_file: |
35 |
for line in open_file: |
36 |
+ line = _unicode_decode(line) |
37 |
if line.startswith('#'): |
38 |
continue |
39 |
fields = [field.strip() for field in line.split(" - ", 1)] |