summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/util/__init__.py17
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