def sig_implicit_deps(self): bld = self.generator.bld key = self.uid() prev = bld.imp_sigs.get(key, []) if prev: try: if prev == self.compute_sig_implicit_deps(): return prev except Errors.TaskNotReady: raise except EnvironmentError: for x in bld.node_deps.get(self.uid(), []): if not x.is_bld() and not x.exists(): try: del x.parent.children[x.name] except KeyError: pass del bld.imp_sigs[key] raise Errors.TaskRescan('rescan') (bld.node_deps[key], bld.raw_deps[key]) = self.scan() if Logs.verbose: Logs.debug('deps: scanner for %s: %r; unresolved: %r', self, bld.node_deps[key], bld.raw_deps[key]) try: bld.imp_sigs[key] = self.compute_sig_implicit_deps() except EnvironmentError: for k in bld.node_deps.get(self.uid(), []): if not k.exists(): Logs.warn( 'Dependency %r for %r is missing: check the task declaration and the build order!', k, self) raise
def sig_implicit_deps(self): """ Used by :py:meth:`waflib.Task.Task.signature`; it hashes node signatures obtained by scanning for dependencies (:py:meth:`waflib.Task.Task.scan`). The exception :py:class:`waflib.Errors.TaskRescan` is thrown when a file has changed. In this case, the method :py:meth:`waflib.Task.Task.signature` is called once again, and return here to call :py:meth:`waflib.Task.Task.scan` and searching for dependencies. """ bld = self.generator.bld # get the task signatures from previous runs key = self.uid() prev = bld.imp_sigs.get(key, []) # for issue #379 if prev: try: if prev == self.compute_sig_implicit_deps(): return prev except Errors.TaskNotReady: raise except OSError: # when a file was renamed, remove the stale nodes (headers in folders without source files) # this will break the order calculation for headers created during the build in the source directory (should be uncommon) # the behaviour will differ when top != out for x in bld.node_deps.get(self.uid(), []): if not x.is_bld() and not x.exists(): try: del x.parent.children[x.name] except KeyError: pass del bld.imp_sigs[key] raise Errors.TaskRescan("rescan") # no previous run or the signature of the dependencies has changed, rescan the dependencies (bld.node_deps[key], bld.raw_deps[key]) = self.scan() if Logs.verbose: Logs.debug( "deps: scanner for %s: %r; unresolved: %r", self, bld.node_deps[key], bld.raw_deps[key], ) # recompute the signature and return it try: bld.imp_sigs[key] = self.compute_sig_implicit_deps() except OSError: for k in bld.node_deps.get(self.uid(), []): if not k.exists(): Logs.warn( "Dependency %r for %r is missing: check the task declaration and the build order!", k, self, ) raise
def sig_implicit_deps(self): bld = self.generator.bld key = self.uid() prev = bld.task_sigs.get((key, 'imp'), []) if prev: try: if prev == self.compute_sig_implicit_deps(): return prev except Errors.TaskNotReady: raise except EnvironmentError: for x in bld.node_deps.get(self.uid(), []): if not x.is_bld(): try: os.stat(x.abspath()) except OSError: try: del x.parent.children[x.name] except KeyError: pass del bld.task_sigs[(key, 'imp')] raise Errors.TaskRescan('rescan') (nodes, names) = self.scan() if Logs.verbose: Logs.debug('deps: scanner for %s returned %s %s' % (str(self), str(nodes), str(names))) bld.node_deps[key] = nodes bld.raw_deps[key] = names self.are_implicit_nodes_ready() try: bld.task_sigs[(key, 'imp')] = sig = self.compute_sig_implicit_deps() except Exception: if Logs.verbose: for k in bld.node_deps.get(self.uid(), []): try: k.get_bld_sig() except Exception: Logs.warn( 'Missing signature for node %r (may cause rebuilds)' % k) else: return sig
def sig_implicit_deps(self): bld = self.generator.bld key = self.uid() prev = bld.task_sigs.get((key, 'imp'), []) if prev: try: if prev == self.compute_sig_implicit_deps(): return prev except IOError: pass del bld.task_sigs[(key, 'imp')] raise Errors.TaskRescan('rescan') (nodes, names) = self.scan() if Logs.verbose: Logs.debug('deps: scanner for %s returned %s %s' % (str(self), str(nodes), str(names))) bld.node_deps[key] = nodes bld.raw_deps[key] = names self.are_implicit_nodes_ready() bld.task_sigs[(key, 'imp')] = sig = self.compute_sig_implicit_deps() return sig
def sig_implicit_deps(self): """ Used by :py:meth:`waflib.Task.Task.signature` hashes node signatures obtained by scanning for dependencies (:py:meth:`waflib.Task.Task.scan`). The exception :py:class:`waflib.Errors.TaskRescan` is thrown when a file has changed. When this occurs, :py:meth:`waflib.Task.Task.signature` is called once again, and this method will be executed once again, this time calling :py:meth:`waflib.Task.Task.scan` for searching the dependencies. :rtype: hash value """ bld = self.generator.bld # get the task signatures from previous runs key = self.uid() prev = bld.task_sigs.get((key, 'imp'), []) # for issue #379 if prev: try: if prev == self.compute_sig_implicit_deps(): return prev except Exception: # when a file was renamed (IOError usually), remove the stale nodes (headers in folders without source files) # this will break the order calculation for headers created during the build in the source directory (should be uncommon) # the behaviour will differ when top != out for x in bld.node_deps.get(self.uid(), []): if x.is_child_of(bld.srcnode): try: os.stat(x.abspath()) except OSError: try: del x.parent.children[x.name] except KeyError: pass del bld.task_sigs[(key, 'imp')] raise Errors.TaskRescan('rescan') # no previous run or the signature of the dependencies has changed, rescan the dependencies (nodes, names) = self.scan() if Logs.verbose: Logs.debug('deps: scanner for %s returned %s %s' % (str(self), str(nodes), str(names))) # store the dependencies in the cache bld.node_deps[key] = nodes bld.raw_deps[key] = names # might happen self.are_implicit_nodes_ready() # recompute the signature and return it try: old_sig_debug_log = self.sig_implicit_debug_log bld.task_sigs[(key, 'imp')] = sig = self.compute_sig_implicit_deps() # Make the equality check since it's possible we didn't have a prior imp key but had prior nodes # and said nodes didn't change if Logs.sig_delta and old_sig_debug_log != self.sig_implicit_debug_log: self.capture_signature_log('\nImplicit(Old):\n') self.capture_signature_log(old_sig_debug_log) self.capture_signature_log('\nImplicit(New):\n') self.capture_signature_log(self.sig_implicit_debug_log) except Exception: if Logs.verbose: for k in bld.node_deps.get(self.uid(), []): try: k.get_bld_sig() except Exception: Logs.warn( 'Missing signature for node %r (may cause rebuilds)' % k) self.capture_signature_log( 'Missing signature for node %r (may cause rebuilds)\n' % k) else: return sig