summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorBinghua Guan <freebendy@gmail.com>2018-06-30 17:53:34 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-05 11:39:06 +0100
commit0996eecb210c9a6e1ae63cb64f2f0b4fef04469d (patch)
treeada9f9e6edec060efaddd4c705d707ff544e659f /meta
parentec9ad3648bd9882fd2004bf5fcb0e0f55e160cc8 (diff)
downloadpoky-0996eecb210c9a6e1ae63cb64f2f0b4fef04469d.tar.gz
oe.types.boolean: treat None as False
It is better to return False for None. E.g. checking an undefined variable returned d.getVar(). (From OE-Core rev: 3048e9fa0df6b1edf79bd1723e0fc022c3332af1) Signed-off-by: Binghua Guan <freebendy@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oe/types.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py
index f778c1de68..f4017130df 100644
--- a/meta/lib/oe/types.py
+++ b/meta/lib/oe/types.py
@@ -103,8 +103,11 @@ def boolean(value):
103 """OpenEmbedded 'boolean' type 103 """OpenEmbedded 'boolean' type
104 104
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', None
107 """ 107 """
108 if value is None:
109 return False
110
108 if isinstance(value, bool): 111 if isinstance(value, bool):
109 return value 112 return value
110 113