From: Zac Medico Date: Wed, 19 Aug 2009 06:21:40 +0000 (-0000) Subject: Use portage.os and _encodings where appropriate. X-Git-Tag: v2.2_rc39~25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2832db9bbc909f35cde6df3cd913237d759375e3;p=portage.git Use portage.os and _encodings where appropriate. svn path=/main/trunk/; revision=14097 --- 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