From 02ad2ab205da281f88505b56ccbbbc7fec593e32 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 10 Mar 2023 21:45:58 +0100 Subject: 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 Signed-off-by: Steve Sakoman Signed-off-by: Richard Purdie --- bitbake/lib/bb/utils.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bitbake') 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): if not string: return default + if isinstance(string, int): + return string != 0 + normalized = string.lower() if normalized in ("y", "yes", "1", "true"): return True -- cgit v1.2.3-54-g00ecf