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:30 +0000 |
commit | 02ad2ab205da281f88505b56ccbbbc7fec593e32 (patch) | |
tree | c08825b094c2ff238ed94f3267ff0cb1d7bc62bb /bitbake | |
parent | 30656ea54de82cabb818f07af711b96211421c95 (diff) | |
download | poky-02ad2ab205da281f88505b56ccbbbc7fec593e32.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: e7df13a61911b7431802af2b4d7472b2aaf346fa)
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>
Diffstat (limited to 'bitbake')
-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 bca4830f22..cdb3c6864b 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -990,6 +990,9 @@ def to_boolean(string, default=None): | |||
990 | if not string: | 990 | if not string: |
991 | return default | 991 | return default |
992 | 992 | ||
993 | if isinstance(string, int): | ||
994 | return string != 0 | ||
995 | |||
993 | normalized = string.lower() | 996 | normalized = string.lower() |
994 | if normalized in ("y", "yes", "1", "true"): | 997 | if normalized in ("y", "yes", "1", "true"): |
995 | return True | 998 | return True |