diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-09-21 18:02:08 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-09-21 18:02:08 +0000 |
commit | d8cd294a4cd4d984f4119d712718b62fab7c1b14 (patch) | |
tree | 829194a6fbbebdd335fecdc87a6e06394e2949f6 | |
parent | 7f5f872e46f65b9422ae2805c15200a74edecabc (diff) | |
download | portage-d8cd294a4cd4d984f4119d712718b62fab7c1b14.tar.gz portage-d8cd294a4cd4d984f4119d712718b62fab7c1b14.tar.bz2 portage-d8cd294a4cd4d984f4119d712718b62fab7c1b14.zip |
Decode all keys in dictionary containing environment passed to os.execve() in portage.process._exec() for compatibility with Python 3.
svn path=/main/trunk/; revision=14352
-rw-r--r-- | pym/portage/process.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pym/portage/process.py b/pym/portage/process.py index 6ce304b4f..428c66f4c 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -11,6 +11,7 @@ import traceback from portage import os from portage import _encodings +from portage import _unicode_decode from portage import _unicode_encode import portage portage.proxy.lazyimport.lazyimport(globals(), @@ -372,8 +373,13 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask, if pre_exec: pre_exec() + # Decode all keys for compatibility with Python 3. + env_decoded = {} + for k, v in env.items(): + env_decoded[_unicode_decode(k)] = v + # And switch to the new process. - os.execve(binary, myargs, env) + os.execve(binary, myargs, env_decoded) def find_binary(binary): """ |