Message ID | 20221124170108.3976978-1-richard.purdie@linuxfoundation.org |
---|---|
State | Accepted, archived |
Commit | ef9c033b011e68bbfedf7ddf118633c14388aaaf |
Headers | show |
Series | utils: Allow to_boolean to support int values | expand |
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 64a004d0d8..f4da356338 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -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
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/utils.py | 3 +++ 1 file changed, 3 insertions(+)