aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <clarson@mvista.com>2010-01-19 10:01:07 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-01-28 14:21:32 +0100
commit6c827d6c799363a15f69840bef4734a61eee7173 (patch)
tree80da6cdc2a3018f1c8e272090c76757598929375
parenta4238313d07c1e756e22975f9559077dfd9c491d (diff)
downloadopenembedded-6c827d6c799363a15f69840bef4734a61eee7173.tar.gz
base.bbclass: add 'any' and 'all' functions.
Python 2.5+ has these functions built-in, but we don't yet require 2.5+. Signed-off-by: Chris Larson <clarson@mvista.com>
-rw-r--r--classes/base.bbclass15
1 files changed, 15 insertions, 0 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 4cf983dc4e..0525cb1035 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -1,5 +1,20 @@
BB_DEFAULT_TASK ?= "build"
+# Useful Python 2.5+ built-in functions
+def any(iterable):
+ """ Return True if any element of the iterable is true. If the iterable is empty, return False. """
+ for element in iterable:
+ if element:
+ return True
+ return False
+
+def all(iterable):
+ """ Return True if all elements of the iterable are true (or if the iterable is empty). """
+ for element in iterable:
+ if not element:
+ return False
+ return True
+
python () {
env = {}
for v in d.keys():