diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-10 21:45:58 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-14 15:05:00 +0000 |
commit | e7df13a61911b7431802af2b4d7472b2aaf346fa (patch) | |
tree | e06967eaa206a27f020ea8590cdfbc582d6d0e3e | |
parent | 9bbdedc0ba7ca819b898e2a29a151d6a2014ca11 (diff) | |
download | bitbake-e7df13a61911b7431802af2b4d7472b2aaf346fa.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 bca4830f2..cdb3c6864 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -990,6 +990,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 |