1 |
commit: 09bdb69ac31146cbb3f258118a1aea0744b96379 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 1 21:21:44 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 1 21:21:44 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=09bdb69a |
7 |
|
8 |
validate_desktop_entry: handle Python 3.1 |
9 |
|
10 |
--- |
11 |
pym/portage/util/_desktop_entry.py | 7 ++++++- |
12 |
1 files changed, 6 insertions(+), 1 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py |
15 |
index 101965f..7901780 100644 |
16 |
--- a/pym/portage/util/_desktop_entry.py |
17 |
+++ b/pym/portage/util/_desktop_entry.py |
18 |
@@ -3,6 +3,7 @@ |
19 |
|
20 |
import io |
21 |
import subprocess |
22 |
+import sys |
23 |
|
24 |
try: |
25 |
from configparser import Error as ConfigParserError, RawConfigParser |
26 |
@@ -41,7 +42,11 @@ _ignored_service_errors = ( |
27 |
) |
28 |
|
29 |
def validate_desktop_entry(path): |
30 |
- proc = subprocess.Popen([b"desktop-file-validate", _unicode_encode(path)], |
31 |
+ args = ["desktop-file-validate", path] |
32 |
+ if sys.hexversion < 0x3000000 or sys.hexversion >= 0x3020000: |
33 |
+ # Python 3.1 does not support bytes in Popen args. |
34 |
+ args = [_unicode_encode(x, errors='strict') for x in args] |
35 |
+ proc = subprocess.Popen(args, |
36 |
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
37 |
output_lines = _unicode_decode(proc.communicate()[0]).splitlines() |
38 |
proc.wait() |