summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-15 07:23:51 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-15 07:23:51 +0000
commit5c69bb17654fe644124c80597fa96baf5394c821 (patch)
tree179a3c377b2f4c80cd04348d94b265d735b05c66
parent61febc7a779917dde5a39b2e02456ef97869d53d (diff)
downloadportage-5c69bb17654fe644124c80597fa96baf5394c821.tar.gz
portage-5c69bb17654fe644124c80597fa96baf5394c821.tar.bz2
portage-5c69bb17654fe644124c80597fa96baf5394c821.zip
Update import to import portage.os (with unicode wrappers), and use
_unicode_encode() and _content_encoding for encoding unicode env vars in spawn(). svn path=/main/trunk/; revision=14062
-rw-r--r--pym/portage/process.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/pym/portage/process.py b/pym/portage/process.py
index 5dcf481e2..1b5846883 100644
--- a/pym/portage/process.py
+++ b/pym/portage/process.py
@@ -4,12 +4,14 @@
# $Id$
-import os
import atexit
import signal
import sys
import traceback
+from portage import os
+from portage import _content_encoding
+from portage import _unicode_encode
import portage
portage.proxy.lazyimport.lazyimport(globals(),
'portage.util:dump_traceback',
@@ -182,11 +184,8 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False,
# Avoid a potential UnicodeEncodeError from os.execve().
env_bytes = {}
for k, v in env.iteritems():
- if isinstance(k, unicode):
- k = k.encode('utf_8', 'replace')
- if isinstance(v, unicode):
- v = v.encode('utf_8', 'replace')
- env_bytes[k] = v
+ env_bytes[_unicode_encode(k, encoding=_content_encoding)] = \
+ _unicode_encode(v, encoding=_content_encoding)
env = env_bytes
del env_bytes