diff options
author | Steven Knight <knight@baldmt.com> | 2005-11-16 02:54:07 +0000 |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-11-16 02:54:07 +0000 |
commit | ba5a267b983b86bdd73a208334982d4819b7ac1f (patch) | |
tree | 9d9d59abb6a7447c7f5b268fbd703228055f6f4a /src/engine/SCons/Action.py | |
parent | 8ba22a6c8436df1895bce98bb6a99b0c8504bc12 (diff) | |
download | scons-ba5a267b983b86bdd73a208334982d4819b7ac1f.tar.gz |
Handle FunctionAction signatures when the function is an object method.
Diffstat (limited to 'src/engine/SCons/Action.py')
-rw-r--r-- | src/engine/SCons/Action.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 98de34e7..25c71332 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -659,22 +659,33 @@ class FunctionAction(_ActionAction): So we remove the line number byte codes to prevent recompilations from moving a Python function. """ + execfunction = self.execfunction try: - # "self.execfunction" is a function. - contents = str(self.execfunction.func_code.co_code) + # Test if execfunction is a function. + code = execfunction.func_code.co_code except AttributeError: - # "self.execfunction" is a callable object. try: - contents = str(self.execfunction.__call__.im_func.func_code.co_code) + # Test if execfunction is a method. + code = execfunction.im_func.func_code.co_code except AttributeError: try: - # See if execfunction will do the heavy lifting for us. - gc = self.execfunction.get_contents + # Test if execfunction is a callable object. + code = execfunction.__call__.im_func.func_code.co_code except AttributeError: - # This is weird, just do the best we can. - contents = str(self.execfunction) + try: + # See if execfunction will do the heavy lifting for us. + gc = self.execfunction.get_contents + except AttributeError: + # This is weird, just do the best we can. + contents = str(self.execfunction) + else: + contents = gc(target, source, env) else: - contents = gc(target, source, env) + contents = str(code) + else: + contents = str(code) + else: + contents = str(code) contents = remove_set_lineno_codes(contents) return contents + env.subst(string.join(map(lambda v: '${'+v+'}', self.varlist))) |