diff --git a/waflib/Node.py b/waflib/Node.py index a9c75e3d..01f0c118 100644 --- a/waflib/Node.py +++ b/waflib/Node.py @@ -806,6 +806,9 @@ class Node(object): "Build path without the file name" return self.parent.bldpath() + def exists(self): + return os.path.exists(self.abspath()) + @Utils.run_once def get_bld_sig(self): """ diff --git a/waflib/Task.py b/waflib/Task.py index 78258336..e29b386a 100644 --- a/waflib/Task.py +++ b/waflib/Task.py @@ -191,7 +191,7 @@ class TaskBase(evil): def process(self): """ - Assume that the task has had a new attribute ``master`` which is an instance of :py:class:`waflib.Runner.Parallel`. + Assume that the task has had a ``master`` which is an instance of :py:class:`waflib.Runner.Parallel`. Execute the task and then put it back in the queue :py:attr:`waflib.Runner.Parallel.out` (may be replaced by subclassing). """ m = self.master @@ -614,7 +614,7 @@ class Task(TaskBase): if sig != key: Logs.debug("task: task %r must run: an output node was produced by another task" % self) return RUN_ME - if not os.path.exists(node.abspath()): + if not node.exists(): Logs.debug("task: task %r must run: an output node does not exist" % self) return RUN_ME @@ -628,18 +628,14 @@ class Task(TaskBase): The node signature is obtained from the task signature, but the output nodes may also get the signature of their contents. See the class decorator :py:func:`waflib.Task.update_outputs` if you need this behaviour. """ - bld = self.generator.bld - sig = self.signature() + dct = self.generator.bld.task_sigs for node in self.outputs: - # check if the output actually exists - try: - os.stat(node.abspath()) - except OSError: + if not node.exists(): self.hasrun = MISSING self.err_msg = '-> missing file: %r' % node.abspath() raise Errors.WafError(self.err_msg) - bld.task_sigs[node] = self.uid() # make sure this task produced the files in question - bld.task_sigs[self.uid()] = self.cache_sig + dct[node] = self.uid() # make sure this task produced the files in question + dct[self.uid()] = self.signature() def sig_explicit_deps(self): """ diff --git a/waflib/extras/cython.py b/waflib/extras/cython.py index 998837d6..8e2b2f47 100644 --- a/waflib/extras/cython.py +++ b/waflib/extras/cython.py @@ -68,7 +68,7 @@ class cython(Task.Task): def post_run(self): for x in self.outputs: if x.name.endswith('.h'): - if not os.path.exists(x.abspath()): + if not x.exists(): if Logs.verbose: Logs.warn('Expected %r' % x.abspath()) x.write('')