Use unicode() so that 2to3 handles py3k compatibility.
authorZac Medico <zmedico@gentoo.org>
Fri, 27 Feb 2009 03:24:13 +0000 (03:24 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 27 Feb 2009 03:24:13 +0000 (03:24 -0000)
svn path=/main/trunk/; revision=12722

pym/portage/sets/shell.py

index 75912c0becd57aa49c8e8c079732f237796038ca..8114b5133f0db3b1af168f907fb54d7a3628bb6d 100644 (file)
@@ -4,7 +4,6 @@
 
 import subprocess
 import os
-import sys
 
 from portage.sets.base import PackageSet
 from portage.sets import SetConfigError
@@ -35,10 +34,7 @@ class CommandOutputSet(PackageSet):
        def load(self):
                pipe = subprocess.Popen(self._command, stdout=subprocess.PIPE, shell=True)
                if pipe.wait() == os.EX_OK:
-                       text = pipe.stdout.read()
-                       if sys.hexversion >= 0x3000000:
-                               encoding = sys.getdefaultencoding()
-                               text = text.decode(encoding, 'replace')
+                       text = unicode(pipe.stdout.read(), errors='replace')
                        self._setAtoms(text.splitlines())
 
        def singleBuilder(self, options, settings, trees):