summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-12-09 05:42:26 +0000
committerZac Medico <zmedico@gentoo.org>2009-12-09 05:42:26 +0000
commit6ef7be46cc376b981a72bd987a91881e4edefb75 (patch)
treed78889933ada14f8fff90b919a81236606a9830b
parente4bd03ae54359072a26e767aa68a9a37d7a65488 (diff)
downloadportage-6ef7be46cc376b981a72bd987a91881e4edefb75.tar.gz
portage-6ef7be46cc376b981a72bd987a91881e4edefb75.tar.bz2
portage-6ef7be46cc376b981a72bd987a91881e4edefb75.zip
When overridding sys.std* in python2, use binary streams.
svn path=/main/trunk/; revision=14974
-rw-r--r--pym/_emerge/BinpkgVerifier.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/pym/_emerge/BinpkgVerifier.py b/pym/_emerge/BinpkgVerifier.py
index 0283883c1..eebccfa74 100644
--- a/pym/_emerge/BinpkgVerifier.py
+++ b/pym/_emerge/BinpkgVerifier.py
@@ -35,13 +35,15 @@ class BinpkgVerifier(AsynchronousTask):
# so that we get the right class (otherwise our
# code that expects the 'buffer' attribute
# will break).
- open_func = open
+ log_file = open(_unicode_encode(self.logfile,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='a', encoding=_encodings['content'],
+ errors='backslashreplace')
else:
- open_func = codecs.open
- log_file = open_func(_unicode_encode(self.logfile,
- encoding=_encodings['fs'], errors='strict'),
- mode='a', encoding=_encodings['content'],
- errors='backslashreplace')
+ # For python2, sys.std* are expected to be binary streams.
+ log_file = open(_unicode_encode(self.logfile,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='ab')
try:
if log_file is not None:
sys.stdout = log_file