diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-10 21:45:16 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-14 15:05:21 +0000 |
commit | 3cc9fe911f764e4553078dbeed9497f6f08336ce (patch) | |
tree | 51756ddafed9173667b86d46ddedd8c03ea6d25c | |
parent | 2fe0c90da89b0a4e2e133f8ffa7a93d71097bb32 (diff) | |
download | bitbake-3cc9fe911f764e4553078dbeed9497f6f08336ce.tar.gz |
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.
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>
-rw-r--r-- | lib/bb/utils.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 6aeaa0dba..d09e17824 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -1008,6 +1008,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 |