oe.utils: add inherits (sync from OE)

(From OE-Core rev: 0bdb38820489a69448e36c75863e2e2d47cdb20f)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chris Larson 2011-03-07 09:47:35 -07:00 committed by Richard Purdie
parent c9d1e20ab7
commit 354d85dd35
1 changed files with 4 additions and 0 deletions

View File

@ -80,3 +80,7 @@ def param_bool(cfg, field, dflt = None):
elif strvalue in ('no', 'n', 'false', 'f', '0'):
return False
raise ValueError("invalid value for boolean parameter '%s': '%s'" % (field, value))
def inherits(d, *classes):
"""Return True if the metadata inherits any of the specified classes"""
return any(bb.data.inherits_class(cls, d) for cls in classes)