summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-06 21:58:41 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-06 21:58:41 +0000
commitb7f246972d6047403bfa507e21644b2004e0c2be (patch)
treedef0ba7aa6c0718cc93ed946927d6f776feb03f9
parenta2353c4af5955173aa1324cacfdb7beb91f492bd (diff)
downloadportage-b7f246972d6047403bfa507e21644b2004e0c2be.tar.gz
portage-b7f246972d6047403bfa507e21644b2004e0c2be.tar.bz2
portage-b7f246972d6047403bfa507e21644b2004e0c2be.zip
Make getconfig() return unicode type and remove corresponding env_update()
workaround from bug #280460. svn path=/main/trunk/; revision=13941
-rw-r--r--pym/portage/__init__.py11
-rw-r--r--pym/portage/util.py4
2 files changed, 4 insertions, 11 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index df7961b14..8b9ac9012 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -686,17 +686,6 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
writemsg("!!! File Not Found: '%s'\n" % file_path, noiselevel=-1)
continue
- # TODO: Make getconfig() return unicode.
- unicode_config = {}
- for k, v in myconfig.iteritems():
- if not isinstance(k, unicode):
- k = unicode(k, encoding='utf8', errors='replace')
- if not isinstance(v, unicode):
- v = unicode(v, encoding='utf8', errors='replace')
- unicode_config[k] = v
- myconfig = unicode_config
- del unicode_config
-
config_list.append(myconfig)
if "SPACE_SEPARATED" in myconfig:
space_separated.update(myconfig["SPACE_SEPARATED"].split())
diff --git a/pym/portage/util.py b/pym/portage/util.py
index 0a8035de6..df66723ec 100644
--- a/pym/portage/util.py
+++ b/pym/portage/util.py
@@ -447,6 +447,10 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
raise portage.exception.CorruptionError("ParseError: Unexpected EOF: "+str(mycfg)+": line "+str(lex.lineno))
else:
return mykeys
+ if not isinstance(key, unicode):
+ key = unicode(key, encoding='utf_8', errors='replace')
+ if not isinstance(val, unicode):
+ val = unicode(val, encoding='utf_8', errors='replace')
if expand:
mykeys[key] = varexpand(val, expand_map)
expand_map[key] = mykeys[key]