diff --git a/ChangeLog b/ChangeLog index 5d8eca1b..917d9d31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +NEW IN WAF 1.7.4 +---------------- +* Fixed a regression in the Node,Task and Context classes + NEW IN WAF 1.7.3 ----------------- * Fixed the LD_LIBRARY_PATH race condition in waf_unit_test #1200 diff --git a/waflib/Context.py b/waflib/Context.py index de197fcf..d61bbada 100644 --- a/waflib/Context.py +++ b/waflib/Context.py @@ -182,6 +182,15 @@ class Context(ctx): self.exec_dict = {'ctx':self, 'conf':self, 'bld':self, 'opt':self} self.logger = None + def __hash__(self): + """ + Return a hash value for storing context objects in dicts or sets. The value is not persistent. + + :return: hash value + :rtype: int + """ + return id(self) + def load(self, tool_list, *k, **kw): """ Load a Waf tool as a module, and try calling the function named :py:const:`waflib.Context.Context.fun` from it. diff --git a/waflib/Node.py b/waflib/Node.py index 521324a5..94c916e2 100644 --- a/waflib/Node.py +++ b/waflib/Node.py @@ -130,6 +130,10 @@ class Node(object): "String representation (abspath), for debugging purposes" return self.abspath() + def __hash__(self): + "Node hash, used for storage in dicts. This hash is not persistent." + return id(self) + def __eq__(self, node): "Node comparison, based on the IDs" return id(self) == id(node) diff --git a/waflib/Task.py b/waflib/Task.py index cc896837..99bbd54e 100644 --- a/waflib/Task.py +++ b/waflib/Task.py @@ -190,6 +190,10 @@ class TaskBase(evil): return 'executing: %s\n' % self.fun.__name__ return self.__class__.__name__ + '\n' + def __hash__(self): + "Very fast hashing scheme but not persistent (replace/implement in subclasses and see :py:meth:`waflib.Task.Task.uid`)" + return id(self) + def exec_command(self, cmd, **kw): """ Wrapper for :py:meth:`waflib.Context.Context.exec_command` which sets a current working directory to ``build.variant_dir``