1 |
Author: zmedico |
2 |
Date: 2009-02-27 03:08:03 +0000 (Fri, 27 Feb 2009) |
3 |
New Revision: 12721 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/sets/shell.py |
7 |
Log: |
8 |
Fix CommandOutputSet to decode binary command output in py3k. |
9 |
|
10 |
|
11 |
Modified: main/trunk/pym/portage/sets/shell.py |
12 |
=================================================================== |
13 |
--- main/trunk/pym/portage/sets/shell.py 2009-02-27 02:43:45 UTC (rev 12720) |
14 |
+++ main/trunk/pym/portage/sets/shell.py 2009-02-27 03:08:03 UTC (rev 12721) |
15 |
@@ -4,6 +4,7 @@ |
16 |
|
17 |
import subprocess |
18 |
import os |
19 |
+import sys |
20 |
|
21 |
from portage.sets.base import PackageSet |
22 |
from portage.sets import SetConfigError |
23 |
@@ -35,8 +36,11 @@ |
24 |
pipe = subprocess.Popen(self._command, stdout=subprocess.PIPE, shell=True) |
25 |
if pipe.wait() == os.EX_OK: |
26 |
text = pipe.stdout.read() |
27 |
- self._setAtoms(text.split("\n")) |
28 |
- |
29 |
+ if sys.hexversion >= 0x3000000: |
30 |
+ encoding = sys.getdefaultencoding() |
31 |
+ text = text.decode(encoding, 'replace') |
32 |
+ self._setAtoms(text.splitlines()) |
33 |
+ |
34 |
def singleBuilder(self, options, settings, trees): |
35 |
if not "command" in options: |
36 |
raise SetConfigError("no command specified") |