mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
parse.ast: avoid code duplication for inherit
(Bitbake rev: 0b11a3d4eab84b372fd45b9537cf0327008daf8d) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
74653168c0
commit
1204ed79fc
@@ -260,11 +260,11 @@ class BBHandlerNode(AstNode):
|
|||||||
bb.data.setVar('__BBHANDLERS', bbhands, data)
|
bb.data.setVar('__BBHANDLERS', bbhands, data)
|
||||||
|
|
||||||
class InheritNode(AstNode):
|
class InheritNode(AstNode):
|
||||||
def __init__(self, files):
|
def __init__(self, classes):
|
||||||
self.n = __word__.findall(files)
|
self.classes = classes
|
||||||
|
|
||||||
def eval(self, data):
|
def eval(self, data):
|
||||||
bb.parse.BBHandler.inherit(self.n, data)
|
bb.parse.BBHandler.inherit(self.classes, data)
|
||||||
|
|
||||||
def handleInclude(statements, m, fn, lineno, force):
|
def handleInclude(statements, m, fn, lineno, force):
|
||||||
statements.append(IncludeNode(m.group(1), fn, lineno, force))
|
statements.append(IncludeNode(m.group(1), fn, lineno, force))
|
||||||
@@ -300,9 +300,8 @@ def handleBBHandlers(statements, m):
|
|||||||
statements.append(BBHandlerNode(m.group(1)))
|
statements.append(BBHandlerNode(m.group(1)))
|
||||||
|
|
||||||
def handleInherit(statements, m):
|
def handleInherit(statements, m):
|
||||||
files = m.group(1)
|
classes = m.group(1)
|
||||||
n = __word__.findall(files)
|
statements.append(InheritNode(__word__.findall(classes)))
|
||||||
statements.append(InheritNode(m.group(1)))
|
|
||||||
|
|
||||||
def finalize(fn, d, variant = None):
|
def finalize(fn, d, variant = None):
|
||||||
for lazykey in bb.data.getVar("__lazy_assigned", d) or ():
|
for lazykey in bb.data.getVar("__lazy_assigned", d) or ():
|
||||||
|
|||||||
@@ -84,17 +84,13 @@ def _logged_communicate(pipe, log, input):
|
|||||||
log.write(data)
|
log.write(data)
|
||||||
return ''.join(outdata), ''.join(errdata)
|
return ''.join(outdata), ''.join(errdata)
|
||||||
|
|
||||||
def run(cmd, input=None, **options):
|
def run(cmd, input=None, log=None, **options):
|
||||||
"""Convenience function to run a command and return its output, raising an
|
"""Convenience function to run a command and return its output, raising an
|
||||||
exception when the command fails"""
|
exception when the command fails"""
|
||||||
|
|
||||||
if isinstance(cmd, basestring) and not "shell" in options:
|
if isinstance(cmd, basestring) and not "shell" in options:
|
||||||
options["shell"] = True
|
options["shell"] = True
|
||||||
|
|
||||||
log = options.get('log')
|
|
||||||
if 'log' in options:
|
|
||||||
del options['log']
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pipe = Popen(cmd, **options)
|
pipe = Popen(cmd, **options)
|
||||||
except OSError, exc:
|
except OSError, exc:
|
||||||
|
|||||||
Reference in New Issue
Block a user