diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-08-19 07:13:53 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-08-19 07:13:53 +0000 |
commit | 1491b861415ded10623101e54c5e0853853455b0 (patch) | |
tree | 96ccd53666cd8442830eb9d6c5528a23079ac03e | |
parent | 238b2a35d20b84d28680320e0c374d6066e2018d (diff) | |
download | portage-1491b861415ded10623101e54c5e0853853455b0.tar.gz portage-1491b861415ded10623101e54c5e0853853455b0.tar.bz2 portage-1491b861415ded10623101e54c5e0853853455b0.zip |
Use _encodings where appropriate.
svn path=/main/trunk/; revision=14100
-rw-r--r-- | pym/_emerge/EbuildBuild.py | 7 | ||||
-rw-r--r-- | pym/_emerge/EbuildFetcher.py | 7 | ||||
-rw-r--r-- | pym/_emerge/EbuildMetadataPhase.py | 15 |
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 |