diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-24 16:54:34 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-27 23:48:15 +0000 |
commit | 6e75972a1f0cadfc09721d853b2cb1135078627c (patch) | |
tree | 74fd2f454519bdd3fc42d422956df0bdbf6466a9 /bitbake/lib/bb/utils.py | |
parent | 0536965bd45670b7024c84f30a79cd652fe87a73 (diff) | |
download | poky-6e75972a1f0cadfc09721d853b2cb1135078627c.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 64a004d0d8..f4da356338 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -992,6 +992,9 @@ def to_boolean(string, default=None): | |||
992 | if not string: | 992 | if not string: |
993 | return default | 993 | return default |
994 | 994 | ||
995 | if isinstance(string, int): | ||
996 | return string != 0 | ||
997 | |||
995 | normalized = string.lower() | 998 | normalized = string.lower() |
996 | if normalized in ("y", "yes", "1", "true"): | 999 | if normalized in ("y", "yes", "1", "true"): |
997 | return True | 1000 | return True |