mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
bitbake: utils: Allow to_boolean to support int values
Some variables may be set as: X = 1 as well the more usual X = "1" so add support to to_boolean to handle this case. (Bitbake rev: e7df13a61911b7431802af2b4d7472b2aaf346fa) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -990,6 +990,9 @@ def to_boolean(string, default=None):
|
|||||||
if not string:
|
if not string:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
if isinstance(string, int):
|
||||||
|
return string != 0
|
||||||
|
|
||||||
normalized = string.lower()
|
normalized = string.lower()
|
||||||
if normalized in ("y", "yes", "1", "true"):
|
if normalized in ("y", "yes", "1", "true"):
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user