diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-03-27 18:49:59 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-03-27 18:49:59 -0700 |
commit | 1f3d3626d0fb716f1566b0cafab738a8008d3881 (patch) | |
tree | 41b4afd3c9bf0d92c0fed30d182ef7ac039a3df7 | |
parent | 0fc7ed733f41e71a0a7fb6e886f6e6a8ec5056cc (diff) | |
download | portage-1f3d3626d0fb716f1566b0cafab738a8008d3881.tar.gz portage-1f3d3626d0fb716f1566b0cafab738a8008d3881.tar.bz2 portage-1f3d3626d0fb716f1566b0cafab738a8008d3881.zip |
varexpand: don't cache results
Caching wasn't really necessary here, and it didn't properly account
for input differences in the 'mydict' parameter.
-rw-r--r-- | pym/portage/util/__init__.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index dd692a13a..fc4b75b20 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -645,15 +645,10 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True): except Exception as e: raise portage.exception.ParseError(str(e)+" in "+mycfg) return mykeys - -#cache expansions of constant strings -cexpand={} + def varexpand(mystring, mydict=None): if mydict is None: mydict = {} - newstring = cexpand.get(" "+mystring, None) - if newstring is not None: - return newstring """ new variable expansion code. Preserves quotes, handles \n, etc. @@ -666,7 +661,7 @@ def varexpand(mystring, mydict=None): insing=0 indoub=0 pos=1 - newstring=" " + newstring = "" while (pos<len(mystring)): if (mystring[pos]=="'") and (mystring[pos-1]!="\\"): if (indoub): @@ -724,7 +719,6 @@ def varexpand(mystring, mydict=None): while mystring[pos] in validchars: if (pos+1)>=len(mystring): if braced: - cexpand[mystring]="" return "" else: pos=pos+1 @@ -733,12 +727,10 @@ def varexpand(mystring, mydict=None): myvarname=mystring[myvstart:pos] if braced: if mystring[pos]!="}": - cexpand[mystring]="" return "" else: pos=pos+1 if len(myvarname)==0: - cexpand[mystring]="" return "" numvars=numvars+1 if myvarname in mydict: @@ -749,9 +741,8 @@ def varexpand(mystring, mydict=None): else: newstring=newstring+mystring[pos] pos=pos+1 - if numvars==0: - cexpand[mystring]=newstring[1:] - return newstring[1:] + + return newstring # broken and removed, but can still be imported pickle_write = None |