Make getconfig() return unicode type and remove corresponding env_update()
authorZac Medico <zmedico@gentoo.org>
Thu, 6 Aug 2009 21:58:41 +0000 (21:58 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 6 Aug 2009 21:58:41 +0000 (21:58 -0000)
workaround from bug #280460.

svn path=/main/trunk/; revision=13941

pym/portage/__init__.py
pym/portage/util.py

index df7961b14fae98cdcd95871a5fd1c06f068ad10e..8b9ac90127a0409f2f85e1fb6d8a4bfe917c51ba 100644 (file)
@@ -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())
index 0a8035de6b3db74b0dbd981a0dfd6312b33ae104..df66723ecade82b3a516a3bdc4743e1a9aeb59f8 100644 (file)
@@ -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]