summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/EbuildBuild.py7
-rw-r--r--pym/_emerge/EbuildFetcher.py7
-rw-r--r--pym/_emerge/EbuildMetadataPhase.py15
3 files changed, 20 insertions, 9 deletions
diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
index f56adb660..55c20ec09 100644
--- a/pym/_emerge/EbuildBuild.py
+++ b/pym/_emerge/EbuildBuild.py
@@ -13,6 +13,8 @@ from _emerge.EbuildBuildDir import EbuildBuildDir
from portage.util import writemsg
import portage
from portage import os
+from portage import _encodings
+from portage import _unicode_encode
import codecs
from portage.output import colorize
class EbuildBuild(CompositeTask):
@@ -182,8 +184,9 @@ class EbuildBuild(CompositeTask):
log_path = self.settings.get("PORTAGE_LOG_FILE")
if 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')
try:
log_file.write(msg)
finally:
diff --git a/pym/_emerge/EbuildFetcher.py b/pym/_emerge/EbuildFetcher.py
index 6ce72b9e3..76ae5bf75 100644
--- a/pym/_emerge/EbuildFetcher.py
+++ b/pym/_emerge/EbuildFetcher.py
@@ -7,6 +7,8 @@ from _emerge.EbuildBuildDir import EbuildBuildDir
import sys
import portage
from portage import os
+from portage import _encodings
+from portage import _unicode_encode
import codecs
from portage.elog.messages import eerror
@@ -88,8 +90,9 @@ class EbuildFetcher(SpawnProcess):
elog_out = None
if self.logfile is not None:
if self.background:
- elog_out = codecs.open(self.logfile, mode='a',
- encoding='utf_8', errors='replace')
+ elog_out = codecs.open(_unicode_encode(self.logfile,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='a', encoding=_encodings['content'], errors='replace')
msg = "Fetch failed for '%s'" % (self.pkg.cpv,)
if self.logfile is not None:
msg += ", Log file:"
diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py
index a84d722be..60b91edb8 100644
--- a/pym/_emerge/EbuildMetadataPhase.py
+++ b/pym/_emerge/EbuildMetadataPhase.py
@@ -8,6 +8,8 @@ import sys
from portage.cache.mappings import slot_dict_class
import portage
from portage import os
+from portage import _encodings
+from portage import _unicode_encode
from itertools import izip
import fcntl
import codecs
@@ -38,8 +40,11 @@ class EbuildMetadataPhase(SubProcess):
os.path.basename(ebuild_path))
if eapi is None and \
'parse-eapi-ebuild-head' in settings.features:
- eapi = portage._parse_eapi_ebuild_head(codecs.open(ebuild_path,
- mode='r', encoding='utf_8', errors='replace'))
+ eapi = portage._parse_eapi_ebuild_head(
+ codecs.open(_unicode_encode(ebuild_path,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'],
+ errors='replace'))
if eapi is not None:
if not portage.eapi_is_supported(eapi):
@@ -82,7 +87,7 @@ class EbuildMetadataPhase(SubProcess):
fd_pipes[self._metadata_fd] = slave_fd
self._raw_metadata = []
- files.ebuild = os.fdopen(master_fd, 'r')
+ files.ebuild = os.fdopen(master_fd, 'rb')
self._reg_id = self.scheduler.register(files.ebuild.fileno(),
self._registered_events, self._output_handler)
self._registered = True
@@ -118,8 +123,8 @@ class EbuildMetadataPhase(SubProcess):
def _set_returncode(self, wait_retval):
SubProcess._set_returncode(self, wait_retval)
if self.returncode == os.EX_OK:
- metadata_lines = u''.join(unicode(chunk,
- encoding='utf_8', errors='replace')
+ metadata_lines = ''.join(unicode(chunk,
+ encoding=_encodings['repo.content'], errors='replace')
for chunk in self._raw_metadata).splitlines()
if len(portage.auxdbkeys) != len(metadata_lines):
# Don't trust bash's returncode if the