From: Richard Purdie Date: Wed, 20 Jun 2018 23:14:31 +0000 (+0100) Subject: oe/types: Allow boolean to accept an existing boolean X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~17581 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=147f5a665fe5073027d92e4acac631f15f08f79f;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git oe/types: Allow boolean to accept an existing boolean Exception: TypeError: boolean accepts a string, not ' is a bit annoying if you pass in True/False. Tweak the function to make it forgive that situation. Signed-off-by: Richard Purdie --- diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py index 4ae58acfacc..f778c1de689 100644 --- a/meta/lib/oe/types.py +++ b/meta/lib/oe/types.py @@ -105,6 +105,8 @@ def boolean(value): Valid values for true: 'yes', 'y', 'true', 't', '1' Valid values for false: 'no', 'n', 'false', 'f', '0' """ + if isinstance(value, bool): + return value if not isinstance(value, str): raise TypeError("boolean accepts a string, not '%s'" % type(value))