summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-02-27 03:08:03 +0000
committerZac Medico <zmedico@gentoo.org>2009-02-27 03:08:03 +0000
commit19dc1c962ccc1f9a33e05e281f46e2a93eaaed8d (patch)
tree38401fcb1e9fb2fbcbd87f6954f926a894e9f162
parent57aaae1ce3f340badc57404b10179836539720e6 (diff)
downloadportage-19dc1c962ccc1f9a33e05e281f46e2a93eaaed8d.tar.gz
portage-19dc1c962ccc1f9a33e05e281f46e2a93eaaed8d.tar.bz2
portage-19dc1c962ccc1f9a33e05e281f46e2a93eaaed8d.zip
Fix CommandOutputSet to decode binary command output in py3k.
svn path=/main/trunk/; revision=12721
-rw-r--r--pym/portage/sets/shell.py8
1 files changed, 6 insertions, 2 deletions
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")