diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2011-02-27 21:54:48 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2011-02-27 21:54:48 (GMT) |
commit | 925ece49f121303e558f9d63b1c138f814465fc8 (patch) | |
tree | fc36afada1d042bbba82f87f85e019bfb6b35574 /src/engine/SCons/Action.py | |
parent | e123fce835056a1e75c6630fe146bb7d45b19970 (diff) | |
download | SCons-925ece49f121303e558f9d63b1c138f814465fc8.zip SCons-925ece49f121303e558f9d63b1c138f814465fc8.tar.gz SCons-925ece49f121303e558f9d63b1c138f814465fc8.tar.bz2 |
Make Action+None and None+Action work as expected (silently ignore the None arg).
Diffstat (limited to 'src/engine/SCons/Action.py')
-rw-r--r-- | src/engine/SCons/Action.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index bb23287..0dc5c2d 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -300,8 +300,10 @@ def _actionAppend(act1, act2): # a single ListAction. a1 = Action(act1) a2 = Action(act2) - if a1 is None or a2 is None: - raise TypeError("Cannot append %s to %s" % (type(act1), type(act2))) + if a1 is None: + return a2 + if a2 is None: + return a1 if isinstance(a1, ListAction): if isinstance(a2, ListAction): return ListAction(a1.list + a2.list) @@ -385,6 +387,10 @@ def _do_create_action(act, kw): # The list of string commands may include a LazyAction, so we # reprocess them via _do_create_list_action. return _do_create_list_action(commands, kw) + # Catch a common error case with a nice message: + if isinstance(act, int) or isinstance(act, float): + raise TypeError("Don't know how to create an Action from a number (%s)"%act) + # Else fail silently (???) return None def _do_create_list_action(act, kw): |