summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-19 10:02:55 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-15 17:07:46 +0000
commita5bb5d625edfe3f23970f38165ef15ad7167efa4 (patch)
tree3e04367d08cc22597d393a58100e967d5e27c60c
parent7cfe3a5e1548c97de8842cfffa8cecc0c6b01690 (diff)
downloadpoky-a5bb5d625edfe3f23970f38165ef15ad7167efa4.tar.gz
bitbake: [parser] Move methodflags over to the ast
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--bitbake/lib/bb/parse/ast.py38
1 files changed, 23 insertions, 15 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 2a2fe1d519..8296fd0a79 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -149,8 +149,27 @@ class PythonMethodNode:
149 if not self.root in __parsed_methods__: 149 if not self.root in __parsed_methods__:
150 text = '\n'.join(self.body) 150 text = '\n'.join(self.body)
151 bb.methodpool.insert_method(self.root, text, self.fn) 151 bb.methodpool.insert_method(self.root, text, self.fn)
152 152
153 153class MethodFlagsNode:
154 def __init__(self, key, m):
155 self.key = key
156 self.m = m
157
158 def eval(self, data):
159 if bb.data.getVar(self.key, data):
160 # clean up old version of this piece of metadata, as its
161 # flags could cause problems
162 bb.data.setVarFlag(self.key, 'python', None, data)
163 bb.data.setVarFlag(self.key, 'fakeroot', None, data)
164 if self.m.group("py") is not None:
165 bb.data.setVarFlag(self.key, "python", "1", data)
166 else:
167 bb.data.delVarFlag(self.key, "python", data)
168 if self.m.group("fr") is not None:
169 bb.data.setVarFlag(self.key, "fakeroot", "1", data)
170 else:
171 bb.data.delVarFlag(self.key, "fakeroot", data)
172
154def handleInclude(statements, m, fn, lineno, data, force): 173def handleInclude(statements, m, fn, lineno, data, force):
155 # AST handling 174 # AST handling
156 statements.append(IncludeNode(m.group(1), fn, lineno, force)) 175 statements.append(IncludeNode(m.group(1), fn, lineno, force))
@@ -177,19 +196,8 @@ def handlePythonMethod(statements, root, body, fn):
177 statements[-1].eval(None) 196 statements[-1].eval(None)
178 197
179def handleMethodFlags(statements, key, m, d): 198def handleMethodFlags(statements, key, m, d):
180 if bb.data.getVar(key, d): 199 statements.append(MethodFlagsNode(key, m))
181 # Clean up old version of this piece of metadata, as its 200 statements[-1].eval(d)
182 # flags could cause problems
183 bb.data.setVarFlag(key, 'python', None, d)
184 bb.data.setVarFlag(key, 'fakeroot', None, d)
185 if m.group("py") is not None:
186 bb.data.setVarFlag(key, "python", "1", d)
187 else:
188 bb.data.delVarFlag(key, "python", d)
189 if m.group("fr") is not None:
190 bb.data.setVarFlag(key, "fakeroot", "1", d)
191 else:
192 bb.data.delVarFlag(key, "fakeroot", d)
193 201
194def handleExportFuncs(statements, m, classes, d): 202def handleExportFuncs(statements, m, classes, d):
195 fns = m.group(1) 203 fns = m.group(1)