diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-08-20 23:00:46 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-08-20 23:00:46 +0000 |
commit | f3392a373d255aa14b86a777ee62ae9a067907d2 (patch) | |
tree | 082ae517ef0e4ecf247d77c2ddab54ba8040d7c8 | |
parent | 62e9c52a4ef25a187892784f8308fac10a072832 (diff) | |
download | portage-f3392a373d255aa14b86a777ee62ae9a067907d2.tar.gz portage-f3392a373d255aa14b86a777ee62ae9a067907d2.tar.bz2 portage-f3392a373d255aa14b86a777ee62ae9a067907d2.zip |
Use _encodings where appropriate.
svn path=/main/trunk/; revision=14105
-rw-r--r-- | pym/_emerge/Scheduler.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 7e0c35f89..cbb52448a 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -11,10 +11,14 @@ import weakref from itertools import izip import portage from portage import os +from portage import _encodings +from portage import _unicode_decode +from portage import _unicode_encode from portage.cache.mappings import slot_dict_class from portage.elog.messages import eerror from portage.output import colorize, create_color_func, darkgreen, red bad = create_color_func("BAD") +from portage.sets import SETPREFIX from portage.sets.base import InternalPackageSet from portage.util import writemsg, writemsg_level @@ -471,10 +475,13 @@ class Scheduler(PollScheduler): def _append_to_log_path(self, log_path, msg): - f = codecs.open(portage._unicode_encode(log_path), mode='a', - encoding='utf_8', errors='replace') + f = codecs.open(_unicode_encode(log_path, + encoding=_encodings['fs'], errors='strict'), + mode='a', encoding=_encodings['content'], + errors='backslashreplace') try: - f.write(portage._unicode_decode(msg)) + f.write(_unicode_decode(msg, + encoding=_encodings['content'], errors='replace')) finally: f.close() @@ -486,8 +493,10 @@ class Scheduler(PollScheduler): background = self._background if background and log_path is not None: - log_file = codecs.open(portage._unicode_encode(log_path), mode='a', - encoding='utf_8', errors='replace') + log_file = codecs.open(_unicode_encode(log_path, + encoding=_encodings['fs'], errors='strict'), + mode='a', encoding=_encodings['content'], + errors='backslashreplace') out = log_file try: @@ -862,8 +871,9 @@ class Scheduler(PollScheduler): log_path = self._locate_failure_log(failed_pkg) if log_path is not None: try: - log_file = codecs.open(portage._unicode_encode(log_path), - mode='r', encoding='utf_8', errors='replace') + log_file = codecs.open(_unicode_encode(log_path, + encoding=_encodings['fs'], errors='strict'), + mode='r', encoding=_encodings['content'], errors='replace') except IOError: pass |