diff options
Diffstat (limited to 'meta/lib/oe/data.py')
-rw-r--r-- | meta/lib/oe/data.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/meta/lib/oe/data.py b/meta/lib/oe/data.py new file mode 100644 index 0000000000..8b7c3cd789 --- /dev/null +++ b/meta/lib/oe/data.py @@ -0,0 +1,13 @@ +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) + + 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))) |