From: Zac Medico Date: Fri, 27 Feb 2009 03:08:03 +0000 (-0000) Subject: Fix CommandOutputSet to decode binary command output in py3k. X-Git-Tag: v2.2_rc24~94 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=19dc1c962ccc1f9a33e05e281f46e2a93eaaed8d;p=portage.git Fix CommandOutputSet to decode binary command output in py3k. svn path=/main/trunk/; revision=12721 --- diff --git a/pym/portage/sets/shell.py b/pym/portage/sets/shell.py index ba1b2422f..75912c0be 100644 --- a/pym/portage/sets/shell.py +++ b/pym/portage/sets/shell.py @@ -4,6 +4,7 @@ import subprocess import os +import sys from portage.sets.base import PackageSet from portage.sets import SetConfigError @@ -35,8 +36,11 @@ class CommandOutputSet(PackageSet): pipe = subprocess.Popen(self._command, stdout=subprocess.PIPE, shell=True) if pipe.wait() == os.EX_OK: text = pipe.stdout.read() - self._setAtoms(text.split("\n")) - + if sys.hexversion >= 0x3000000: + encoding = sys.getdefaultencoding() + text = text.decode(encoding, 'replace') + self._setAtoms(text.splitlines()) + def singleBuilder(self, options, settings, trees): if not "command" in options: raise SetConfigError("no command specified")