diff options
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 82e5dc4277..075ca88ab5 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -856,3 +856,17 @@ def to_boolean(string, default=None): | |||
856 | return False | 856 | return False |
857 | else: | 857 | else: |
858 | raise ValueError("Invalid value for to_boolean: %s" % string) | 858 | raise ValueError("Invalid value for to_boolean: %s" % string) |
859 | |||
860 | def contains(variable, checkvalues, truevalue, falsevalue, d): | ||
861 | val = d.getVar(variable, True) | ||
862 | if not val: | ||
863 | return falsevalue | ||
864 | matches = 0 | ||
865 | if type(checkvalues).__name__ == "str": | ||
866 | checkvalues = [checkvalues] | ||
867 | for value in checkvalues: | ||
868 | if val.find(value) != -1: | ||
869 | matches = matches + 1 | ||
870 | if matches == len(checkvalues): | ||
871 | return truevalue | ||
872 | return falsevalue | ||