summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-06-21 00:14:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-06-21 09:34:40 +0100
commit6cf9204d3bc55d4811ce112a1cd7c990b4199b93 (patch)
tree0f28f7cb31542f652102f959967a5f24838ba1fe
parent160477e043751cf1fa3ddbd7825c64467a186a40 (diff)
downloadpoky-6cf9204d3bc55d4811ce112a1cd7c990b4199b93.tar.gz
oe/types: Allow boolean to accept an existing boolean
Exception: TypeError: boolean accepts a string, not '<class 'bool'> is a bit annoying if you pass in True/False. Tweak the function to make it forgive that situation. (From OE-Core rev: 147f5a665fe5073027d92e4acac631f15f08f79f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/types.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py
index 4ae58acfac..f778c1de68 100644
--- a/meta/lib/oe/types.py
+++ b/meta/lib/oe/types.py
@@ -105,6 +105,8 @@ def boolean(value):
105 Valid values for true: 'yes', 'y', 'true', 't', '1' 105 Valid values for true: 'yes', 'y', 'true', 't', '1'
106 Valid values for false: 'no', 'n', 'false', 'f', '0' 106 Valid values for false: 'no', 'n', 'false', 'f', '0'
107 """ 107 """
108 if isinstance(value, bool):
109 return value
108 110
109 if not isinstance(value, str): 111 if not isinstance(value, str):
110 raise TypeError("boolean accepts a string, not '%s'" % type(value)) 112 raise TypeError("boolean accepts a string, not '%s'" % type(value))