From b7f246972d6047403bfa507e21644b2004e0c2be Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 6 Aug 2009 21:58:41 +0000 Subject: Make getconfig() return unicode type and remove corresponding env_update() workaround from bug #280460. svn path=/main/trunk/; revision=13941 --- pym/portage/__init__.py | 11 ----------- pym/portage/util.py | 4 ++++ 2 files changed, 4 insertions(+), 11 deletions(-) (limited to 'pym') 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] -- cgit v1.2.3-1-g7c22