utils: Allow to_boolean to support int values
PATCH 1/1 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 <[email protected]>
--- lib/bb/utils.py | 3 +++ 1 file changed, 3 insertions(+)
lib/bb/utils.py +3 -0
@@ -992,6 +992,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
Signature · 1 line
2.34.1