Index: wafadmin/Scripting.py =================================================================== --- wafadmin/Scripting.py (revision 1451) +++ wafadmin/Scripting.py (working copy) @@ -135,10 +135,10 @@ hash = 0 for file in proj['files']: mod = Utils.load_module(file) - hash = Params.hash_sig_weak(hash, inspect.getsource(mod.configure).__hash__()) + hash = Params.hash_function_with_globals(hash, mod.configure) reconf = (hash != proj['hash']) - except: - warning("Reconfiguring the project as an exception occured") + except Exception, ex: + warning("Reconfiguring the project as an exception occured: %s" % (str(ex),)) reconf=1 if reconf: Index: wafadmin/Configure.py =================================================================== --- wafadmin/Configure.py (revision 1451) +++ wafadmin/Configure.py (working copy) @@ -994,7 +994,7 @@ ret = mod.configure(self) if Params.g_autoconfig: - self.hash = Params.hash_sig_weak(self.hash, inspect.getsource(mod.configure).__hash__()) + self.hash = Params.hash_function_with_globals(self.hash, mod.configure) self.files.append(os.path.abspath(cur)) self.cwd = current return ret Index: wafadmin/Params.py =================================================================== --- wafadmin/Params.py (revision 1451) +++ wafadmin/Params.py (working copy) @@ -254,6 +254,19 @@ m.update(o1) m.update(o2) return m.digest() + +def hash_function_with_globals(prevhash, func): + for name, value in func.func_globals.iteritems(): + if type(value) in (types.BuiltinFunctionType, + types.ModuleType, + types.FunctionType): + continue + try: + prevhash = hash_sig_weak(prevhash, (name, value)) + except TypeError: # raised for unhashable elements + pass + return hash_sig_weak(prevhash, inspect.getsource(func)) + ## # hash string def h_md5_str(str):