[oe-commits] [bitbake] branch 1.30 updated: lib/bb/utils: add docstring for contains()

git at git.openembedded.org git at git.openembedded.org
Mon Apr 18 15:29:10 UTC 2016


rpurdie pushed a commit to branch 1.30
in repository bitbake.

The following commit(s) were added to refs/heads/1.30 by this push:
       new  e917472   lib/bb/utils: add docstring for contains()
e917472 is described below

commit e9174723ea6d0dff5f7f3042009761cf42284947
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Tue Apr 5 15:46:41 2016 +0100

    lib/bb/utils: add docstring for contains()
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/utils.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 8d7df13..3544bbe 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -924,6 +924,24 @@ def to_boolean(string, default=None):
         raise ValueError("Invalid value for to_boolean: %s" % string)
 
 def contains(variable, checkvalues, truevalue, falsevalue, d):
+    """Check if a variable contains all the values specified.
+
+    Arguments:
+
+    variable -- the variable name. This will be fetched and expanded (using
+    d.getVar(variable, True)) and then split into a set().
+
+    checkvalues -- if this is a string it is split on whitespace into a set(),
+    otherwise coerced directly into a set().
+
+    truevalue -- the value to return if checkvalues is a subset of variable.
+
+    falsevalue -- the value to return if variable is empty or if checkvalues is
+    not a subset of variable.
+
+    d -- the data store.
+    """
+
     val = d.getVar(variable, True)
     if not val:
         return falsevalue
@@ -932,7 +950,7 @@ def contains(variable, checkvalues, truevalue, falsevalue, d):
         checkvalues = set(checkvalues.split())
     else:
         checkvalues = set(checkvalues)
-    if checkvalues.issubset(val): 
+    if checkvalues.issubset(val):
         return truevalue
     return falsevalue
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list