import sys
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
+import codecs
import os
from portage.output import colorize
class Binpkg(CompositeTask):
log_path = self.settings.get("PORTAGE_LOG_FILE")
if log_path is not None:
- f = open(log_path, 'a')
+ f = codecs.open(log_path, mode='a',
+ encoding='utf_8', errors='replace')
try:
f.write(msg)
finally:
else:
continue
- f = open(os.path.join(infloc, k), 'wb')
+ f = codecs.open(os.path.join(infloc, k), mode='w',
+ encoding='utf_8', errors='replace')
try:
f.write(v + "\n")
finally:
import sys
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
+import codecs
import os
class BinpkgVerifier(AsynchronousTask):
__slots__ = ("logfile", "pkg",)
stderr_orig = sys.stderr
log_file = None
if self.background and self.logfile is not None:
- log_file = open(self.logfile, 'a')
+ log_file = codecs.open(self.logfile, mode='a',
+ encoding='utf_8', errors='replace')
try:
if log_file is not None:
sys.stdout = log_file
import sys
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
+import codecs
import os
from portage.output import colorize
class EbuildBuild(CompositeTask):
log_path = self.settings.get("PORTAGE_LOG_FILE")
if log_path is not None:
- log_file = open(log_path, 'a')
+ log_file = codecs.open(log_path, mode='a',
+ encoding='utf_8', errors='replace')
try:
log_file.write(msg)
finally:
import sys
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
+import codecs
import os
from portage.elog.messages import eerror
class EbuildFetcher(SpawnProcess):
elog_out = None
if self.logfile is not None:
if self.background:
- elog_out = open(self.logfile, 'a')
+ elog_out = codecs.open(self.logfile, mode='a',
+ encoding='utf_8', errors='replace')
msg = "Fetch failed for '%s'" % (self.pkg.cpv,)
if self.logfile is not None:
msg += ", Log file:"
import sys
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
+import codecs
import os
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 = open(log_path, 'a')
+ log_file = codecs.open(log_path, mode='a',
+ encoding='utf_8', errors='replace')
out = log_file
try:
portage._check_build_log(self.settings, out=out)
# Distributed under the terms of the GNU General Public License v2
# $Id$
+import codecs
import logging
import os
portage.util.writemsg_level(msg,
level=level, noiselevel=noiselevel)
- f = open(log_path, 'a')
+ f = codecs.open(log_path, mode='a',
+ encoding='utf_8', errors='replace')
try:
f.write(msg)
finally:
# Distributed under the terms of the GNU General Public License v2
# $Id$
+import codecs
import os
import re
next = next[:-3]
changelogpath = os.path.join(os.path.split(ebuildpath)[0],'ChangeLog')
try:
- changelog = open(changelogpath).read()
+ changelog = codecs.open(changelogpath, mode='r',
+ encoding='utf_8', errors='replace').read()
except SystemExit, e:
raise # Needed else can't exit
except:
if "--changelog" in self._frozen_config.myopts:
print
for revision,text in changelogs:
+
+ if sys.hexversion < 0x3000000:
+ # avoid potential UnicodeEncodeError
+ if isinstance(revision, unicode):
+ revision = revision.encode('utf_8', 'replace')
+ if isinstance(text, unicode):
+ text = text.encode('utf_8', 'replace')
+
print bold('*'+revision)
sys.stdout.write(text)
# Distributed under the terms of the GNU General Public License v2
# $Id$
+import codecs
import os
import sys
import time
xtermTitle(short_msg)
try:
file_path = os.path.join(_emerge_log_dir, 'emerge.log')
- mylogfile = open(file_path, "a")
+ mylogfile = codecs.open(file_path, mode='a',
+ encoding='utf_8', errors='replace')
portage.util.apply_secpass_permissions(file_path,
uid=portage.portage_uid, gid=portage.portage_gid,
mode=0660)