diff options
author | Holger Freyther <ich@tamarin.(none)> | 2009-05-18 20:03:50 +0200 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-02-15 17:07:40 +0000 |
commit | a20105868f093bf78f00fe6026db80475cfe7cc0 (patch) | |
tree | 1e504193844645f090a790f5cf68a9153d6c729b /bitbake/lib/bb | |
parent | 269d4d58a924ba34b0f4cfa8bc9dce948a79e2ef (diff) | |
download | poky-a20105868f093bf78f00fe6026db80475cfe7cc0.tar.gz |
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.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 55bf847d1b..26bd7236c9 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
@@ -26,6 +26,12 @@ import bb, re, string | |||
26 | __word__ = re.compile(r"\S+") | 26 | __word__ = re.compile(r"\S+") |
27 | __parsed_methods__ = bb.methodpool.get_parsed_dict() | 27 | __parsed_methods__ = bb.methodpool.get_parsed_dict() |
28 | 28 | ||
29 | def getFunc(groupd, key, data): | ||
30 | if 'flag' in groupd and groupd['flag'] != None: | ||
31 | return bb.data.getVarFlag(key, groupd['flag'], data) | ||
32 | else: | ||
33 | return bb.data.getVar(key, data) | ||
34 | |||
29 | class StatementGroup: | 35 | class StatementGroup: |
30 | def __init__(self): | 36 | def __init__(self): |
31 | self.statements = [] | 37 | self.statements = [] |
@@ -78,13 +84,19 @@ class DataNode: | |||
78 | def __init__(self, groupd): | 84 | def __init__(self, groupd): |
79 | self.groupd = groupd | 85 | self.groupd = groupd |
80 | 86 | ||
87 | def getFunc(self, key, data): | ||
88 | if 'flag' in self.groupd and self.groupd['flag'] != None: | ||
89 | return bb.data.getVarFlag(key, self.groupd['flag'], data) | ||
90 | else: | ||
91 | return bb.data.getVar(key, data) | ||
92 | |||
81 | def eval(self, data): | 93 | def eval(self, data): |
82 | groupd = self.groupd | 94 | groupd = self.groupd |
83 | key = groupd["var"] | 95 | key = groupd["var"] |
84 | if "exp" in groupd and groupd["exp"] != None: | 96 | if "exp" in groupd and groupd["exp"] != None: |
85 | bb.data.setVarFlag(key, "export", 1, data) | 97 | bb.data.setVarFlag(key, "export", 1, data) |
86 | if "ques" in groupd and groupd["ques"] != None: | 98 | if "ques" in groupd and groupd["ques"] != None: |
87 | val = getFunc(groupd, key, data) | 99 | val = self.getFunc(key, data) |
88 | if val == None: | 100 | if val == None: |
89 | val = groupd["value"] | 101 | val = groupd["value"] |
90 | elif "colon" in groupd and groupd["colon"] != None: | 102 | elif "colon" in groupd and groupd["colon"] != None: |
@@ -92,13 +104,13 @@ class DataNode: | |||
92 | bb.data.update_data(e) | 104 | bb.data.update_data(e) |
93 | val = bb.data.expand(groupd["value"], e) | 105 | val = bb.data.expand(groupd["value"], e) |
94 | elif "append" in groupd and groupd["append"] != None: | 106 | elif "append" in groupd and groupd["append"] != None: |
95 | val = "%s %s" % ((getFunc(groupd, key, data) or ""), groupd["value"]) | 107 | val = "%s %s" % ((self.getFunc(key, data) or ""), groupd["value"]) |
96 | elif "prepend" in groupd and groupd["prepend"] != None: | 108 | elif "prepend" in groupd and groupd["prepend"] != None: |
97 | val = "%s %s" % (groupd["value"], (getFunc(groupd, key, data) or "")) | 109 | val = "%s %s" % (groupd["value"], (self.getFunc(key, data) or "")) |
98 | elif "postdot" in groupd and groupd["postdot"] != None: | 110 | elif "postdot" in groupd and groupd["postdot"] != None: |
99 | val = "%s%s" % ((getFunc(groupd, key, data) or ""), groupd["value"]) | 111 | val = "%s%s" % ((self.getFunc(key, data) or ""), groupd["value"]) |
100 | elif "predot" in groupd and groupd["predot"] != None: | 112 | elif "predot" in groupd and groupd["predot"] != None: |
101 | val = "%s%s" % (groupd["value"], (getFunc(groupd, key, data) or "")) | 113 | val = "%s%s" % (groupd["value"], (self.getFunc(key, data) or "")) |
102 | else: | 114 | else: |
103 | val = groupd["value"] | 115 | val = groupd["value"] |
104 | if 'flag' in groupd and groupd['flag'] != None: | 116 | if 'flag' in groupd and groupd['flag'] != None: |
@@ -108,7 +120,6 @@ class DataNode: | |||
108 | bb.data.setVar(key, val, data) | 120 | bb.data.setVar(key, val, data) |
109 | 121 | ||
110 | 122 | ||
111 | |||
112 | def handleInclude(statements, m, fn, lineno, data, force): | 123 | def handleInclude(statements, m, fn, lineno, data, force): |
113 | # AST handling | 124 | # AST handling |
114 | statements.append(IncludeNode(m.group(1), fn, lineno, force)) | 125 | statements.append(IncludeNode(m.group(1), fn, lineno, force)) |
@@ -157,12 +168,6 @@ def handleData(statements, groupd, data): | |||
157 | else: | 168 | else: |
158 | bb.data.setVar(key, val, data) | 169 | bb.data.setVar(key, val, data) |
159 | 170 | ||
160 | def getFunc(groupd, key, data): | ||
161 | if 'flag' in groupd and groupd['flag'] != None: | ||
162 | return bb.data.getVarFlag(key, groupd['flag'], data) | ||
163 | else: | ||
164 | return bb.data.getVar(key, data) | ||
165 | |||
166 | def handleMethod(statements, func_name, lineno, fn, body, d): | 171 | def handleMethod(statements, func_name, lineno, fn, body, d): |
167 | if func_name == "__anonymous": | 172 | if func_name == "__anonymous": |
168 | funcname = ("__anon_%s_%s" % (lineno, fn.translate(string.maketrans('/.+-', '____')))) | 173 | funcname = ("__anon_%s_%s" % (lineno, fn.translate(string.maketrans('/.+-', '____')))) |