generic-poky/meta/lib/oe/data.py
Chris Larson 4da8c86ca2 oe.data: expand the flags
(From OE-Core rev: 8b9de6d2ad2d351bbc288cbb12562806ba8edae2)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-20 17:34:22 +01:00

19 lines
639 B
Python

import oe.maketype
import bb.msg
def typed_value(key, d):
"""Construct a value for the specified metadata variable, using its flags
to determine the type and parameters for construction."""
var_type = d.getVarFlag(key, 'type')
flags = d.getVarFlags(key)
if flags is not None:
flags = dict((flag, bb.data.expand(value, d))
for flag, value in flags.iteritems())
else:
flags = {}
try:
return oe.maketype.create(d.getVar(key, True) or '', var_type, **flags)
except (TypeError, ValueError), exc:
bb.msg.fatal(bb.msg.domain.Data, "%s: %s" % (key, str(exc)))