From 3faa635fd408695dd5b754fda3f6060dd670b81d Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Fri, 11 Feb 2011 11:43:54 -0600 Subject: fetch2: unpack revision Revise the unpack function to have a way to disable the unpack. This is based on the work from "Andreas Oberritter ", see http://cgit.openembedded.net/cgit.cgi/openembedded/commit/?id=2bdfe8519eda8067845019a699acdf19a21ba380 In addition, the to_boolean function comes from the work of "Chris Larson ", see http://cgit.openembedded.net/cgit.cgi/openembedded/commit/?id=900cc29b603691eb3a077cb660545ead3715ed54 Signed-off-by: Mark Hatle --- bitbake/lib/bb/utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bitbake/lib/bb/utils.py') diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 0b5aa0d5f..b2f8bb6f8 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -831,3 +831,15 @@ def init_logger(logger, verbose, debug, debug_domains): if debug_domains: bb.msg.set_debug_domains(debug_domains) + +def to_boolean(string, default=None): + if not string: + return default + + normalized = string.lower() + if normalized in ("y", "yes", "1", "true"): + return True + elif normalized in ("n", "no", "0", "false"): + return False + else: + raise ValueError("Invalid value for to_boolean: %s" % string) -- cgit v1.2.3