summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-18 20:03:50 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-15 17:07:40 +0000
commita20105868f093bf78f00fe6026db80475cfe7cc0 (patch)
tree1e504193844645f090a790f5cf68a9153d6c729b /bitbake/lib/bb
parent269d4d58a924ba34b0f4cfa8bc9dce948a79e2ef (diff)
downloadopenembedded-core-a20105868f093bf78f00fe6026db80475cfe7cc0.tar.gz
openembedded-core-a20105868f093bf78f00fe6026db80475cfe7cc0.tar.bz2
openembedded-core-a20105868f093bf78f00fe6026db80475cfe7cc0.tar.xz
openembedded-core-a20105868f093bf78f00fe6026db80475cfe7cc0.zip
bitbake: [parser] Prepare to cease out getFunc
getFunc is now a method of the data node, hopefully we can kill the other version soon. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/parse/ast.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 55bf847d1..26bd7236c 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -26,6 +26,12 @@ import bb, re, string
__word__ = re.compile(r"\S+")
__parsed_methods__ = bb.methodpool.get_parsed_dict()
+def getFunc(groupd, key, data):
+ if 'flag' in groupd and groupd['flag'] != None:
+ return bb.data.getVarFlag(key, groupd['flag'], data)
+ else:
+ return bb.data.getVar(key, data)
+
class StatementGroup:
def __init__(self):
self.statements = []
@@ -78,13 +84,19 @@ class DataNode:
def __init__(self, groupd):
self.groupd = groupd
+ def getFunc(self, key, data):
+ if 'flag' in self.groupd and self.groupd['flag'] != None:
+ return bb.data.getVarFlag(key, self.groupd['flag'], data)
+ else:
+ return bb.data.getVar(key, data)
+
def eval(self, data):
groupd = self.groupd
key = groupd["var"]
if "exp" in groupd and groupd["exp"] != None:
bb.data.setVarFlag(key, "export", 1, data)
if "ques" in groupd and groupd["ques"] != None:
- val = getFunc(groupd, key, data)
+ val = self.getFunc(key, data)
if val == None:
val = groupd["value"]
elif "colon" in groupd and groupd["colon"] != None:
@@ -92,13 +104,13 @@ class DataNode:
bb.data.update_data(e)
val = bb.data.expand(groupd["value"], e)
elif "append" in groupd and groupd["append"] != None:
- val = "%s %s" % ((getFunc(groupd, key, data) or ""), groupd["value"])
+ val = "%s %s" % ((self.getFunc(key, data) or ""), groupd["value"])
elif "prepend" in groupd and groupd["prepend"] != None:
- val = "%s %s" % (groupd["value"], (getFunc(groupd, key, data) or ""))
+ val = "%s %s" % (groupd["value"], (self.getFunc(key, data) or ""))
elif "postdot" in groupd and groupd["postdot"] != None:
- val = "%s%s" % ((getFunc(groupd, key, data) or ""), groupd["value"])
+ val = "%s%s" % ((self.getFunc(key, data) or ""), groupd["value"])
elif "predot" in groupd and groupd["predot"] != None:
- val = "%s%s" % (groupd["value"], (getFunc(groupd, key, data) or ""))
+ val = "%s%s" % (groupd["value"], (self.getFunc(key, data) or ""))
else:
val = groupd["value"]
if 'flag' in groupd and groupd['flag'] != None:
@@ -108,7 +120,6 @@ class DataNode:
bb.data.setVar(key, val, data)
-
def handleInclude(statements, m, fn, lineno, data, force):
# AST handling
statements.append(IncludeNode(m.group(1), fn, lineno, force))
@@ -157,12 +168,6 @@ def handleData(statements, groupd, data):
else:
bb.data.setVar(key, val, data)
-def getFunc(groupd, key, data):
- if 'flag' in groupd and groupd['flag'] != None:
- return bb.data.getVarFlag(key, groupd['flag'], data)
- else:
- return bb.data.getVar(key, data)
-
def handleMethod(statements, func_name, lineno, fn, body, d):
if func_name == "__anonymous":
funcname = ("__anon_%s_%s" % (lineno, fn.translate(string.maketrans('/.+-', '____'))))