def finalize(self): assert not self._finalized self._h_hash = hashfn("".join(self._includes).encode("utf-8")).hexdigest() if not isfile(self.h_path): with open(self.h_path, "w") as uncompiled_header: uncompiled_header.writelines(self._includes) self._finalized = True
def __init__(self, path, graph): super().__init__(path) _project = graph.target.project mangled_path_base = splitext(_project.mangle_path(path))[0] self._dirs = graph.target.dirs self._mangled_path_base = mangled_path_base self._includes = [] self._finalized = False self._h_hash = None # self._content_hash = None with open(path, "r+b") as f: self._content_hash = hashfn(f.read()).hexdigest()