summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-19 06:21:40 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-19 06:21:40 +0000
commit2832db9bbc909f35cde6df3cd913237d759375e3 (patch)
tree26fed6792e02027fd36dff6e91ed60b7065b82d0
parentd599c68c8e6609f5facdc97f333112d91a501468 (diff)
downloadportage-2832db9bbc909f35cde6df3cd913237d759375e3.tar.gz
portage-2832db9bbc909f35cde6df3cd913237d759375e3.tar.bz2
portage-2832db9bbc909f35cde6df3cd913237d759375e3.zip
Use portage.os and _encodings where appropriate.
svn path=/main/trunk/; revision=14097
-rw-r--r--pym/repoman/utilities.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 9ea5ff467..cf32399d3 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -18,16 +18,19 @@ __all__ = [
"parse_metadata_use"
]
+import codecs
import commands
import errno
import itertools
import logging
-import os
import sys
from xml.dom import minidom
from xml.dom import NotFoundErr
from xml.parsers.expat import ExpatError
+from portage import os
+from portage import _encodings
+from portage import _unicode_encode
from portage import output
from portage.output import red, green
from portage.process import find_binary
@@ -282,7 +285,10 @@ def get_commit_message_with_editor(editor, message=None):
if not (os.WIFEXITED(retval) and os.WEXITSTATUS(retval) == os.EX_OK):
return None
try:
- mylines = open(filename).readlines()
+ mylines = codecs.open(_unicode_encode(filename,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['content'], errors='replace'
+ ).readlines()
except OSError, e:
if e.errno != errno.ENOENT:
raise