aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2018-09-05 15:16:17 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-12 08:17:27 +0100
commitfc5a5af7bc3619f575988a75efc0c4fe15478b2d (patch)
tree84715890f4e66487a616a4e53a90e7dffe2dde6e /meta/lib/oe
parentdf1874eda517070dab86270ffafd5fe9a307e76b (diff)
downloadopenembedded-core-contrib-fc5a5af7bc3619f575988a75efc0c4fe15478b2d.tar.gz
oe/utils.py: Add vartrue()
It can be used to simplify code like: "${@['iffalse', 'iftrue'][var]}" Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index fbda7035f1..93b0763b0a 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -25,6 +25,13 @@ def conditional(variable, checkvalue, truevalue, falsevalue, d):
else:
return falsevalue
+def vartrue(var, iftrue, iffalse, d):
+ import oe.types
+ if oe.types.boolean(d.getVar(var)):
+ return iftrue
+ else:
+ return iffalse
+
def less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
if float(d.getVar(variable)) <= float(checkvalue):
return truevalue
@@ -467,3 +474,4 @@ class ImageQAFailed(bb.build.FuncFailed):
msg = msg + ' (%s)' % self.description
return msg
+