bitbake/BBHandler: Save python functions into the dictonary
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
parent
f7627e4f67
commit
13fdd4ae5d
|
@ -137,7 +137,8 @@ class MethodNode:
|
||||||
bb.data.setVar(self.func_name, '\n'.join(self.body), data)
|
bb.data.setVar(self.func_name, '\n'.join(self.body), data)
|
||||||
|
|
||||||
class PythonMethodNode(AstNode):
|
class PythonMethodNode(AstNode):
|
||||||
def __init__(self, root, body, fn):
|
def __init__(self, funcname, root, body, fn):
|
||||||
|
self.func_name = funcname
|
||||||
self.root = root
|
self.root = root
|
||||||
self.body = body
|
self.body = body
|
||||||
self.fn = fn
|
self.fn = fn
|
||||||
|
@ -149,6 +150,9 @@ class PythonMethodNode(AstNode):
|
||||||
if not bb.methodpool.parsed_module(self.root):
|
if not bb.methodpool.parsed_module(self.root):
|
||||||
text = '\n'.join(self.body)
|
text = '\n'.join(self.body)
|
||||||
bb.methodpool.insert_method(self.root, text, self.fn)
|
bb.methodpool.insert_method(self.root, text, self.fn)
|
||||||
|
bb.data.setVarFlag(self.func_name, "func", 1, data)
|
||||||
|
bb.data.setVarFlag(self.func_name, "python", 1, data)
|
||||||
|
bb.data.setVar(self.func_name, text, data)
|
||||||
|
|
||||||
class MethodFlagsNode(AstNode):
|
class MethodFlagsNode(AstNode):
|
||||||
def __init__(self, key, m):
|
def __init__(self, key, m):
|
||||||
|
@ -270,8 +274,8 @@ def handleData(statements, groupd):
|
||||||
def handleMethod(statements, func_name, lineno, fn, body):
|
def handleMethod(statements, func_name, lineno, fn, body):
|
||||||
statements.append(MethodNode(func_name, body, lineno, fn))
|
statements.append(MethodNode(func_name, body, lineno, fn))
|
||||||
|
|
||||||
def handlePythonMethod(statements, root, body, fn):
|
def handlePythonMethod(statements, funcname, root, body, fn):
|
||||||
statements.append(PythonMethodNode(root, body, fn))
|
statements.append(PythonMethodNode(funcname, root, body, fn))
|
||||||
|
|
||||||
def handleMethodFlags(statements, key, m):
|
def handleMethodFlags(statements, key, m):
|
||||||
statements.append(MethodFlagsNode(key, m))
|
statements.append(MethodFlagsNode(key, m))
|
||||||
|
|
|
@ -183,7 +183,7 @@ def feeder(lineno, s, fn, root, statements):
|
||||||
__body__.append(s)
|
__body__.append(s)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
ast.handlePythonMethod(statements, root, __body__, fn)
|
ast.handlePythonMethod(statements, __inpython__, root, __body__, fn)
|
||||||
__body__ = []
|
__body__ = []
|
||||||
__inpython__ = False
|
__inpython__ = False
|
||||||
|
|
||||||
|
@ -210,7 +210,8 @@ def feeder(lineno, s, fn, root, statements):
|
||||||
m = __def_regexp__.match(s)
|
m = __def_regexp__.match(s)
|
||||||
if m:
|
if m:
|
||||||
__body__.append(s)
|
__body__.append(s)
|
||||||
__inpython__ = True
|
__inpython__ = m.group(1)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
m = __export_func_regexp__.match(s)
|
m = __export_func_regexp__.match(s)
|
||||||
|
|
Loading…
Reference in New Issue