summaryrefslogtreecommitdiff
path: root/bitbake/lib
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-05-21 13:08:44 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:34 +0100
commitd00b54b948ecc9a23e39a10a15d9b8c1e564240f (patch)
tree2a2b84f019d47df99ad5cb5146acdc7da26f860c /bitbake/lib
parente07a5b1909d26d6a28910002daf1c0ea21e05ea3 (diff)
downloadopenembedded-core-d00b54b948ecc9a23e39a10a15d9b8c1e564240f.tar.gz
openembedded-core-d00b54b948ecc9a23e39a10a15d9b8c1e564240f.tar.bz2
openembedded-core-d00b54b948ecc9a23e39a10a15d9b8c1e564240f.tar.xz
openembedded-core-d00b54b948ecc9a23e39a10a15d9b8c1e564240f.zip
In expand, drop the unnecessary second regular expression match
(Bitbake rev: 05462fa7908fc22988b3dc9d376798d0a46ccb5a) Signed-off-by: Imran Mehmood <imran_mehmood@mentor.com> Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/data_smart.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 01a333024..1f2908927 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -37,7 +37,6 @@ from bb.COW import COWDictBase
__setvar_keyword__ = ["_append", "_prepend"]
__setvar_regexp__ = re.compile('(?P<base>.*?)(?P<keyword>_append|_prepend)(_(?P<add>.*))?')
__expand_var_regexp__ = re.compile(r"\${[^{}]+}")
-__expand_python_regexp__ = re.compile(r"\${@.+?}")
class DataSmart:
@@ -51,23 +50,25 @@ class DataSmart:
self.expand_cache = {}
def expand(self, s, varname):
+ def python_sub(code):
+ codeobj = compile(code.strip(), varname or "<expansion>", "eval")
+ value = utils.better_eval(codeobj, {"d": self})
+ return str(value)
+
def var_sub(match):
key = match.group()[2:-1]
- if varname and key:
- if varname == key:
- raise Exception("variable %s references itself!" % varname)
+ if key[0] == "@":
+ return python_sub(key[1:])
+
+ if varname == key:
+ raise Exception("variable %s references itself!" % varname)
+
var = self.getVar(key, 1)
if var is not None:
return var
else:
return match.group()
- def python_sub(match):
- code = match.group()[3:-1]
- codeobj = compile(code.strip(), varname or "<expansion>", "eval")
- value = utils.better_eval(codeobj, {"d": self})
- return str(value)
-
if not isinstance(s, basestring): # sanity check
return s
@@ -78,7 +79,6 @@ class DataSmart:
olds = s
try:
s = __expand_var_regexp__.sub(var_sub, s)
- s = __expand_python_regexp__.sub(python_sub, s)
if s == olds:
break
except KeyboardInterrupt: