summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/EbuildPhase.py12
-rw-r--r--pym/_emerge/PackageUninstall.py7
2 files changed, 13 insertions, 6 deletions
diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py
index 9d2ec632d..51f018cb1 100644
--- a/pym/_emerge/EbuildPhase.py
+++ b/pym/_emerge/EbuildPhase.py
@@ -8,6 +8,8 @@ from _emerge.CompositeTask import CompositeTask
from portage.util import writemsg
import portage
from portage import os
+from portage import _encodings
+from portage import _unicode_encode
import codecs
class EbuildPhase(CompositeTask):
@@ -32,8 +34,9 @@ class EbuildPhase(CompositeTask):
log_path = self.settings.get("PORTAGE_LOG_FILE")
log_file = None
if self.background and log_path is not None:
- log_file = codecs.open(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='replace')
out = log_file
try:
portage._check_build_log(self.settings, out=out)
@@ -52,8 +55,9 @@ class EbuildPhase(CompositeTask):
log_path = self.settings.get("PORTAGE_LOG_FILE")
log_file = None
if self.background and log_path is not None:
- log_file = codecs.open(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='replace')
out = log_file
portage._post_src_install_chost_fix(settings)
portage._post_src_install_uid_fix(settings, out=out)
diff --git a/pym/_emerge/PackageUninstall.py b/pym/_emerge/PackageUninstall.py
index d86947c4a..fdd59e149 100644
--- a/pym/_emerge/PackageUninstall.py
+++ b/pym/_emerge/PackageUninstall.py
@@ -6,6 +6,8 @@ import codecs
import logging
import portage
from portage import os
+from portage import _encodings
+from portage import _unicode_encode
from _emerge.AsynchronousTask import AsynchronousTask
from _emerge.unmerge import unmerge
from _emerge.UninstallFailure import UninstallFailure
@@ -45,8 +47,9 @@ class PackageUninstall(AsynchronousTask):
portage.util.writemsg_level(msg,
level=level, noiselevel=noiselevel)
- f = codecs.open(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='replace')
try:
f.write(msg)
finally: