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 @@ | |||
1 | import oe.maketype | ||
2 | import bb.msg | ||
3 | |||
4 | def typed_value(key, d): | ||
5 | """Construct a value for the specified metadata variable, using its flags | ||
6 | to determine the type and parameters for construction.""" | ||
7 | var_type = d.getVarFlag(key, 'type') | ||
8 | flags = d.getVarFlags(key) | ||
9 | |||
10 | try: | ||
11 | return oe.maketype.create(d.getVar(key, True) or '', var_type, **flags) | ||
12 | except (TypeError, ValueError), exc: | ||
13 | bb.msg.fatal(bb.msg.domain.Data, "%s: %s" % (key, str(exc))) | ||