From 238b2a35d20b84d28680320e0c374d6066e2018d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 19 Aug 2009 06:55:17 +0000 Subject: [PATCH] Use _encodings where appropriate. svn path=/main/trunk/; revision=14099 --- pym/_emerge/Binpkg.py | 16 +++++++++++----- pym/_emerge/BinpkgVerifier.py | 7 +++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pym/_emerge/Binpkg.py b/pym/_emerge/Binpkg.py index 00c6620fd..68d75f9be 100644 --- a/pym/_emerge/Binpkg.py +++ b/pym/_emerge/Binpkg.py @@ -12,6 +12,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 @@ -31,8 +33,9 @@ class Binpkg(CompositeTask): log_path = self.settings.get("PORTAGE_LOG_FILE") if log_path is not None: - 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: @@ -225,15 +228,18 @@ class Binpkg(CompositeTask): else: continue - f = codecs.open(os.path.join(infloc, k), mode='w', - encoding='utf_8', errors='replace') + f = codecs.open(_unicode_encode(os.path.join(infloc, k), + encoding=_encodings['fs'], errors='strict'), + mode='w', encoding=_encodings['content'], errors='replace') try: f.write(v + "\n") finally: f.close() # Store the md5sum in the vdb. - f = open(os.path.join(infloc, "BINPKGMD5"), "w") + f = codecs.open(_unicode_encode(os.path.join(infloc, 'BINPKGMD5'), + encoding=_encodings['fs'], errors='strict'), + mode='w', encoding=_encodings['content'], errors='strict') try: f.write(str(portage.checksum.perform_md5(pkg_path)) + "\n") finally: diff --git a/pym/_emerge/BinpkgVerifier.py b/pym/_emerge/BinpkgVerifier.py index 31599e2e2..36e1bb8b6 100644 --- a/pym/_emerge/BinpkgVerifier.py +++ b/pym/_emerge/BinpkgVerifier.py @@ -7,6 +7,8 @@ from portage.util import writemsg import sys import portage from portage import os +from portage import _encodings +from portage import _unicode_encode import codecs class BinpkgVerifier(AsynchronousTask): @@ -27,8 +29,9 @@ class BinpkgVerifier(AsynchronousTask): stderr_orig = sys.stderr log_file = None if self.background and self.logfile is not None: - log_file = codecs.open(self.logfile, mode='a', - encoding='utf_8', errors='replace') + log_file = codecs.open(_unicode_encode(self.logfile, + encoding=_encodings['fs'], errors='strict'), + mode='a', encoding=_encodings['content'], errors='replace') try: if log_file is not None: sys.stdout = log_file -- 2.26.2