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: ef9c033b011e68bbfedf7ddf118633c14388aaaf)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2022-11-24 16:54:34 +00:00
parent 0536965bd4
commit 6e75972a1f

View File

@@ -992,6 +992,9 @@ def to_boolean(string, default=None):
if not string:
return default
if isinstance(string, int):
return string != 0
normalized = string.lower()
if normalized in ("y", "yes", "1", "true"):
return True