def sig_explicit_deps(self): bld = self.generator.bld m = md5() for x in self.inputs + getattr(self, "dep_nodes", []): if not x.parent.id in bld.cache_scanned_folders: bld.rescan(x.parent) variant = x.variant(self.env) m.update(bld.node_sigs[variant][x.id]) if bld.deps_man: additional_deps = bld.deps_man for x in self.inputs + self.outputs: try: d = additional_deps[x.id] except KeyError: continue for v in d: if isinstance(v, Node.Node): bld.rescan(v.parent) variant = v.variant(self.env) try: v = bld.node_sigs[variant][v.id] except KeyError: v = "" elif hasattr(v, "__call__"): v = v() m.update(v) for x in self.deps_nodes: v = bld.node_sigs[x.variant(self.env)][x.id] m.update(v) return m.digest()
def signature(self): # compute the result one time, and suppose the scan_signature will give the good result try: return self.cache_sig[0] except AttributeError: pass m = md5() # explicit deps exp_sig = self.sig_explicit_deps() m.update(exp_sig) # implicit deps imp_sig = self.scan and self.sig_implicit_deps() or SIG_NIL m.update(imp_sig) # env vars var_sig = self.sig_vars() m.update(var_sig) # we now have the signature (first element) and the details (for debugging) ret = m.digest() self.cache_sig = (ret, exp_sig, imp_sig, var_sig) return ret
def sig_explicit_deps(self): bld=self.generator.bld m=md5() for x in self.inputs: variant=x.variant(self.env) m.update(bld.node_sigs[variant][x.id]) for x in getattr(self,'dep_nodes',[]): variant=x.variant(self.env) v=bld.node_sigs[variant][x.id] m.update(v) try: additional_deps=bld.deps_man except AttributeError: pass else: for x in self.inputs+self.outputs: try: d=additional_deps[x.id] except KeyError: continue if callable(d): d=d() for v in d: if isinstance(v,Node.Node): bld.rescan(v.parent) variant=v.variant(self.env) try: v=bld.node_sigs[variant][v.id] except KeyError: v='' m.update(v) return m.digest()
def sig_explicit_deps(self): bld = self.generator.bld m = md5() for x in self.inputs + getattr(self, 'dep_nodes', []): if not x.parent.id in bld.cache_scanned_folders: bld.rescan(x.parent) variant = x.variant(self.env) m.update(bld.node_sigs[variant][x.id]) if bld.deps_man: additional_deps = bld.deps_man for x in self.inputs + self.outputs: try: d = additional_deps[x.id] except KeyError: continue for v in d: if isinstance(v, Node.Node): bld.rescan(v.parent) variant = v.variant(self.env) try: v = bld.node_sigs[variant][v.id] except KeyError: v = '' elif hasattr(v, '__call__'): v = v() m.update(v) for x in self.deps_nodes: v = bld.node_sigs[x.variant(self.env)][x.id] m.update(v) return m.digest()
def signature(self): # compute the result one time, and suppose the scan_signature will give the good result try: return self.cache_sig[0] except AttributeError: pass self.m = md5() # explicit deps exp_sig = self.sig_explicit_deps() # env vars var_sig = self.sig_vars() # implicit deps imp_sig = SIG_NIL if self.scan: try: imp_sig = self.sig_implicit_deps() except ValueError: return self.signature() # we now have the signature (first element) and the details (for debugging) ret = self.m.digest() self.cache_sig = (ret, exp_sig, imp_sig, var_sig) return ret
def sig_vars(self): m = md5() bld = self.generator.bld env = self.env act_sig = bld.hash_env_vars(env, self.__class__.vars) m.update(act_sig) dep_vars = getattr(self, "dep_vars", None) if dep_vars: m.update(bld.hash_env_vars(env, dep_vars)) return m.digest()
def sig_vars(self): m = md5() bld = self.generator.bld env = self.env act_sig = bld.hash_env_vars(env, self.__class__.vars) m.update(act_sig) dep_vars = getattr(self, 'dep_vars', None) if dep_vars: m.update(bld.hash_env_vars(env, dep_vars)) return m.digest()
def CalculateDownScaledMD5(clip, dnw, dnh, path, algo, LogCmdOnly): dnScaleMD5 = GetDownScaledMD5File(clip, dnw, dnh, path, algo) if LogCmdOnly == 1: if Platform == "Linux": cmd = "md5sum %s &> %s" % (clip.file_path, dnScaleMD5) ExecuteCmd(cmd, 1) else: f = open(dnScaleMD5, 'wt') dnScaledOut = GetDownScaledOutFile(clip, dnw, dnh, path, algo) MD5 = md5(dnScaledOut) f.write(MD5) f.close()
def signature(self): try:return self.cache_sig[0] except AttributeError:pass m=md5() exp_sig=self.sig_explicit_deps() m.update(exp_sig) imp_sig=self.scan and self.sig_implicit_deps()or SIG_NIL m.update(imp_sig) var_sig=self.sig_vars() m.update(var_sig) ret=m.digest() self.cache_sig=(ret,exp_sig,imp_sig,var_sig) return ret
def unique_id(self): try: return self.uid except AttributeError: m=md5() up=m.update up(self.env.variant()) for x in self.inputs+self.outputs: up(x.abspath()) up(self.__class__.__name__) up(Utils.h_fun(self.run)) self.uid=m.digest() return self.uid
def compute_sig_implicit_deps(self): m = md5() upd = m.update bld = self.generator.bld tstamp = bld.node_sigs env = self.env for k in bld.node_deps.get(self.unique_id(), []): if not k.parent.id in bld.cache_scanned_folders: bld.rescan(k.parent) if k.id & 3 == 2: upd(tstamp[0][k.id]) else: upd(tstamp[env.variant()][k.id]) return m.digest()
def unique_id(self): "get a unique id: hash the node paths, the variant, the class, the function" try: return self.uid except AttributeError: m = md5() up = m.update up(self.env.variant()) for x in self.inputs + self.outputs: up(x.abspath()) up(self.__class__.__name__) up(Utils.h_fun(self.run)) self.uid = m.digest() return self.uid
def sig_vars(self): m = md5() bld = self.generator.bld env = self.env # dependencies on the environment vars act_sig = bld.hash_env_vars(env, self.__class__.vars) m.update(act_sig) # additional variable dependencies, if provided dep_vars = getattr(self, 'dep_vars', None) if dep_vars: m.update(bld.hash_env_vars(env, dep_vars)) return m.digest()
def signature(self): try:return self.cache_sig[0] except AttributeError:pass self.m=md5() exp_sig=self.sig_explicit_deps() var_sig=self.sig_vars() imp_sig=SIG_NIL if self.scan: try: imp_sig=self.sig_implicit_deps() except ValueError: return self.signature() ret=self.m.digest() self.cache_sig=(ret,exp_sig,imp_sig,var_sig) return ret
def signature(self): try: return self.cache_sig[0] except AttributeError: pass m = md5() exp_sig = self.sig_explicit_deps() m.update(exp_sig) imp_sig = self.scan and self.sig_implicit_deps() or SIG_NIL m.update(imp_sig) var_sig = self.sig_vars() m.update(var_sig) ret = m.digest() self.cache_sig = (ret, exp_sig, imp_sig, var_sig) return ret
def unique_id(self): try: return self.uid except AttributeError: m = md5() up = m.update up(self.__class__.__name__) up(self.env.variant()) p = None for x in self.inputs + self.outputs: if p != x.parent.id: p = x.parent.id up(x.parent.abspath()) up(x.name) self.uid = m.digest() return self.uid
def sig_vars(self): m=md5() bld=self.generator.bld env=self.env act_sig=bld.hash_env_vars(env,self.__class__.vars) m.update(act_sig) var_sig=SIG_NIL dep_vars=getattr(self,'dep_vars',None) if dep_vars: var_sig=bld.hash_env_vars(env,dep_vars) m.update(var_sig) for x in getattr(self.__class__,'vars',()): k=env[x] if k: m.update(str(k)) vars_sig=hash((var_sig,str(k))) return m.digest()
def sig_explicit_deps(self): bld = self.generator.bld m = md5() # the inputs for x in self.inputs + getattr(self, 'dep_nodes', []): if not x.parent.id in bld.cache_scanned_folders: bld.rescan(x.parent) variant = x.variant(self.env) try: m.update(bld.node_sigs[variant][x.id]) except KeyError: raise Utils.WafError( 'Missing node signature for %r (required by %r)' % (x, self)) # manual dependencies, they can slow down the builds if bld.deps_man: additional_deps = bld.deps_man for x in self.inputs + self.outputs: try: d = additional_deps[x.id] except KeyError: continue for v in d: if isinstance(v, Node.Node): bld.rescan(v.parent) variant = v.variant(self.env) try: v = bld.node_sigs[variant][v.id] except KeyError: raise Utils.WafError( 'Missing node signature for %r (required by %r)' % (v, self)) elif hasattr(v, '__call__'): v = v() # dependency is a function, call it m.update(v) for x in self.deps_nodes: v = bld.node_sigs[x.variant(self.env)][x.id] m.update(v) return m.digest()
def unique_id(self): "get a unique id: hash the node paths, the variant, the class, the function" try: return self.uid except AttributeError: "this is not a real hot zone, but we want to avoid surprizes here" m = md5() up = m.update up(self.__class__.__name__) up(self.env.variant()) p = None for x in self.inputs + self.outputs: if p != x.parent.id: p = x.parent.id up(x.parent.abspath()) up(x.name) self.uid = m.digest() return self.uid
def sig_explicit_deps(self): bld = self.generator.bld m = md5() # the inputs for x in self.inputs + getattr(self, 'dep_nodes', []): if not x.parent.id in bld.cache_scanned_folders: bld.rescan(x.parent) variant = x.variant(self.env) try: m.update(bld.node_sigs[variant][x.id]) except KeyError: raise Utils.WafError('Missing node signature for %r (required by %r)' % (x, self)) # manual dependencies, they can slow down the builds if bld.deps_man: additional_deps = bld.deps_man for x in self.inputs + self.outputs: try: d = additional_deps[x.id] except KeyError: continue for v in d: if isinstance(v, Node.Node): bld.rescan(v.parent) variant = v.variant(self.env) try: v = bld.node_sigs[variant][v.id] except KeyError: raise Utils.WafError('Missing node signature for %r (required by %r)' % (v, self)) elif hasattr(v, '__call__'): v = v() # dependency is a function, call it m.update(v) for x in self.deps_nodes: v = bld.node_sigs[x.variant(self.env)][x.id] m.update(v) return m.digest()
def sig_explicit_deps(self): bld = self.generator.bld m = md5() # the inputs for x in self.inputs: variant = x.variant(self.env) m.update(bld.node_sigs[variant][x.id]) # additional nodes to depend on, if provided for x in getattr(self, "dep_nodes", []): variant = x.variant(self.env) v = bld.node_sigs[variant][x.id] m.update(v) # manual dependencies, they can slow down the builds try: additional_deps = bld.deps_man except AttributeError: pass else: for x in self.inputs + self.outputs: try: d = additional_deps[x.id] except KeyError: continue if callable(d): d = d() # dependency is a function, call it for v in d: if isinstance(v, Node.Node): bld.rescan(v.parent) variant = v.variant(self.env) try: v = bld.node_sigs[variant][v.id] except KeyError: # make it fatal? v = "" m.update(v) return m.digest()
def compute_sig_implicit_deps(self): """it is intented for .cpp and inferred .h files there is a single list (no tree traversal) this is the hot spot so ... do not touch""" m = md5() upd = m.update bld = self.generator.bld tstamp = bld.node_sigs env = self.env for k in bld.node_deps.get(self.unique_id(), []) + self.inputs: # unlikely but necessary if it happens if not k.parent.id in bld.cache_scanned_folders: bld.rescan(k.parent) if k.id & 3 == Node.FILE: upd(tstamp[0][k.id]) else: upd(tstamp[env.variant()][k.id]) return m.digest()
def compute_sig_implicit_deps(self): """it is intended for .cpp and inferred .h files there is a single list (no tree traversal) this is the hot spot so ... do not touch""" m = md5() upd = m.update bld = self.generator.bld tstamp = bld.node_sigs env = self.env for k in bld.node_deps.get(self.unique_id(), []): # unlikely but necessary if it happens if not k.parent.id in bld.cache_scanned_folders: # if the parent folder is removed, an OSError may be thrown bld.rescan(k.parent) # if the parent folder is removed, a KeyError will be thrown if k.id & 3 == 2: # Node.FILE: upd(tstamp[0][k.id]) else: upd(tstamp[env.variant()][k.id]) return m.digest()