From 1fbcd2ca178db28747046b5bd943c81176db9f65 Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Tue, 3 Aug 2010 18:18:03 +0100 Subject: lib/oe: sync with OE.dev Most notable change is the move to creating symlinks to patches in the metadata tree rather than copying them. Signed-off-by: Joshua Lock --- meta/lib/oe/utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'meta/lib/oe/utils.py') diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index e61d663a50..3469700726 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py @@ -67,3 +67,14 @@ def str_filter(f, str, d): def str_filter_out(f, str, d): from re import match return " ".join(filter(lambda x: not match(f, x, 0), str.split())) + +def param_bool(cfg, field, dflt = None): + """Lookup in map and convert it to a boolean; take + when this does not exist""" + value = cfg.get(field, dflt) + strvalue = str(value).lower() + if strvalue in ('yes', 'y', 'true', 't', '1'): + return True + elif strvalue in ('no', 'n', 'false', 'f', '0'): + return False + raise ValueError("invalid value for boolean parameter '%s': '%s'" % (field, value)) -- cgit 1.2.3-korg