diff options
Diffstat (limited to 'src/engine/SCons/compat/builtins.py')
-rw-r--r-- | src/engine/SCons/compat/builtins.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/engine/SCons/compat/builtins.py b/src/engine/SCons/compat/builtins.py index 1124cf0..a4c3080 100644 --- a/src/engine/SCons/compat/builtins.py +++ b/src/engine/SCons/compat/builtins.py @@ -35,6 +35,8 @@ the earliest ones we support. This module checks for the following __builtin__ names: + all() + any() bool() dict() True @@ -58,6 +60,36 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import __builtin__ try: + all +except NameError: + # Pre-2.5 Python has no all() function. + def all(iterable): + """ + Returns True if all elements of the iterable are true. + """ + for element in iterable: + if not element: + return False + return True + __builtin__.all = all + all = all + +try: + any +except NameError: + # Pre-2.5 Python has no any() function. + def any(iterable): + """ + Returns True if any element of the iterable is true. + """ + for element in iterable: + if element: + return True + return False + __builtin__.any = any + any = any + +try: bool except NameError: # Pre-2.2 Python has no bool() function. |