summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pym/gentoolkit/equery')
-rw-r--r--pym/gentoolkit/equery/uses.py11
-rw-r--r--pym/gentoolkit/equery/which.py5
2 files changed, 11 insertions, 5 deletions
diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py
index 79f1118..a8f13dc 100644
--- a/pym/gentoolkit/equery/uses.py
+++ b/pym/gentoolkit/equery/uses.py
@@ -16,6 +16,9 @@ __docformat__ = 'epytext'
import os
import sys
+if sys.hexversion < 0x3000000:
+ from io import open
+
from functools import partial
from getopt import gnu_getopt, GetoptError
from glob import glob
@@ -136,9 +139,9 @@ def get_global_useflags():
# Get global USE flag descriptions
try:
path = os.path.join(settings["PORTDIR"], 'profiles', 'use.desc')
- with open(_unicode_encode(path, encoding=_encodings['fs'])) as open_file:
+ with open(_unicode_encode(path, encoding=_encodings['fs']),
+ encoding=_encodings['content']) 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']
@@ -157,9 +160,9 @@ def get_global_useflags():
for path in glob(os.path.join(settings["PORTDIR"],
'profiles', 'desc', '*.desc')):
try:
- with open(_unicode_encode(path, encoding=_encodings['fs'])) as open_file:
+ with open(_unicode_encode(path, encoding=_encodings['fs']),
+ encoding=_encodings['content']) 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)]
diff --git a/pym/gentoolkit/equery/which.py b/pym/gentoolkit/equery/which.py
index 0d30a8d..137e52a 100644
--- a/pym/gentoolkit/equery/which.py
+++ b/pym/gentoolkit/equery/which.py
@@ -18,6 +18,8 @@ __docformat__ = 'epytext'
import os
import sys
+if sys.hexversion < 0x3000000:
+ from io import open
from getopt import gnu_getopt, GetoptError
@@ -62,7 +64,8 @@ def print_help(with_description=True):
def print_ebuild(ebuild_path):
"""Output the ebuild to std_out"""
- with open(_unicode_encode(ebuild_path, encoding=_encodings['fs'])) as f:
+ with open(_unicode_encode(ebuild_path, encoding=_encodings['fs']),
+ encoding=_encodings['content']) as f:
lines = f.readlines()
print("\n\n")
print("".join(lines))