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:25:03 +0000 |
commit | dde7a392c576c69adecece1c62e0adfe3097510c (patch) | |
tree | cf777494d9033848a46ad58d628832146f2f716a | |
parent | 69553e43659c9033286d4ce4510f3be8bc3885c4 (diff) | |
download | poky-dde7a392c576c69adecece1c62e0adfe3097510c.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: 3cc9fe911f764e4553078dbeed9497f6f08336ce)
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-- | 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 6aeaa0dba0..d09e178249 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -1008,6 +1008,9 @@ def to_boolean(string, default=None): | |||
1008 | if not string: | 1008 | if not string: |
1009 | return default | 1009 | return default |
1010 | 1010 | ||
1011 | if isinstance(string, int): | ||
1012 | return string != 0 | ||
1013 | |||
1011 | normalized = string.lower() | 1014 | normalized = string.lower() |
1012 | if normalized in ("y", "yes", "1", "true"): | 1015 | if normalized in ("y", "yes", "1", "true"): |
1013 | return True | 1016 | return True |