aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-05-01 14:21:44 -0700
committerZac Medico <zmedico@gentoo.org>2012-05-01 14:21:44 -0700
commit09bdb69ac31146cbb3f258118a1aea0744b96379 (patch)
treed41f8b666190a25a3202f1dddfe51e706b658aa5 /pym/portage/util/_desktop_entry.py
parentBug #413983: Add portage.util.urlopen(), which transparently (diff)
downloadportage-09bdb69ac31146cbb3f258118a1aea0744b96379.tar.gz
portage-09bdb69ac31146cbb3f258118a1aea0744b96379.tar.bz2
portage-09bdb69ac31146cbb3f258118a1aea0744b96379.zip
validate_desktop_entry: handle Python 3.1
Diffstat (limited to 'pym/portage/util/_desktop_entry.py')
-rw-r--r--pym/portage/util/_desktop_entry.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index 101965f6a..790178013 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -3,6 +3,7 @@
import io
import subprocess
+import sys
try:
from configparser import Error as ConfigParserError, RawConfigParser
@@ -41,7 +42,11 @@ _ignored_service_errors = (
)
def validate_desktop_entry(path):
- proc = subprocess.Popen([b"desktop-file-validate", _unicode_encode(path)],
+ args = ["desktop-file-validate", path]
+ if sys.hexversion < 0x3000000 or sys.hexversion >= 0x3020000:
+ # Python 3.1 does not support bytes in Popen args.
+ args = [_unicode_encode(x, errors='strict') for x in args]
+ proc = subprocess.Popen(args,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output_lines = _unicode_decode(proc.communicate()[0]).splitlines()
proc.wait()