def build_all(self): """Builds the entire tree. Returns the number of failures.""" failures = 0 path_cache = PathCache(self.env) # We keep a dummy connection here that does not do anything which # helps us with the WAL handling. See #144 con = self.connect_to_database() try: with reporter.build("build", self): self.env.plugin_controller.emit("before-build-all", builder=self) to_build = self.get_initial_build_queue() while to_build: source = to_build.popleft() prog, build_state = self.build(source, path_cache=path_cache) self.extend_build_queue(to_build, prog) failures += len(build_state.failed_artifacts) self.env.plugin_controller.emit("after-build-all", builder=self) if failures: reporter.report_build_all_failure(failures) return failures finally: con.close()
def build_all(self): """Builds the entire tree. Returns the number of failures.""" failures = 0 path_cache = PathCache(self.env) # We keep a dummy connection here that does not do anything which # helps us with the WAL handling. See #144 con = self.connect_to_database() try: with reporter.build('build', self): self.env.plugin_controller.emit('before-build-all', builder=self) to_build = self.get_initial_build_queue() paraArgs = [] while to_build: # while to_build: source = to_build.popleft() # paraArgs.append({'builder': self, 'source': source, 'path_cache': path_cache}) prog, build_state = self.build( source, path_cache=path_cache) # @@@@@LUKAS parallelize # res = lukas_buildStuff(paraArgs) # @@@@@LUKAS parallelize # for prog, build_state in res: self.extend_build_queue(to_build, prog) failures += len(build_state.failed_artifacts) self.env.plugin_controller.emit('after-build-all', builder=self) if failures: reporter.report_build_all_failure(failures) return failures finally: con.close()
def build_all(self): """Builds the entire tree.""" with reporter.build("build", self): to_build = [self.pad.root, self.pad.asset_root] while to_build: source = to_build.pop() prog = self.build(source) to_build.extend(prog.iter_child_sources())
def build_all(self): """Builds the entire tree.""" with reporter.build('build', self): to_build = [self.pad.root, self.pad.asset_root] while to_build: source = to_build.pop() prog = self.build(source) to_build.extend(prog.iter_child_sources())
def build_all(self): """Builds the entire tree.""" with reporter.build("build", self): self.env.plugin_controller.emit("before_build_all", builder=self) to_build = self.pad.get_all_roots() while to_build: source = to_build.pop() prog = self.build(source) to_build.extend(prog.iter_child_sources()) self.env.plugin_controller.emit("after_build_all", builder=self)
def build_all(self): """Builds the entire tree.""" path_cache = PathCache(self.env) with reporter.build('build', self): self.env.plugin_controller.emit('before-build-all', builder=self) to_build = self.get_initial_build_queue() while to_build: source = to_build.popleft() prog = self.build(source, path_cache=path_cache) self.extend_build_queue(to_build, prog) self.env.plugin_controller.emit('after-build-all', builder=self)
def remove(ctx, relpath): lektor_cli_ctx = Context() lektor_cli_ctx.load_plugins() env = lektor_cli_ctx.get_env() path = os.path.join(OUTPUT_DIR, relpath) with CliReporter(env, verbosity=0), reporter.build('prune', None): if os.path.exists(path): reporter.report_pruned_artifact(relpath) if os.path.isdir(path): shutil.rmtree(path) else: os.remove(path)
def update_all_source_infos(self): """Fast way to update all source infos without having to build everything. """ with reporter.build('source info update', self): with self.new_build_state() as build_state: to_build = self.get_initial_build_queue() while to_build: source = to_build.popleft() with reporter.process_source(source): prog = self.get_build_program(source, build_state) self.update_source_info(prog, build_state) self.extend_build_queue(to_build, prog) build_state.prune_source_infos()
def prune(self, all=False): """This cleans up data left in the build folder that does not correspond to known artifacts. """ with reporter.build(all and "clean" or "prune", self): with self.new_build_state() as build_state: for aft in build_state.iter_unreferenced_artifacts(all=all): reporter.report_pruned_artifact(aft) filename = build_state.get_destination_filename(aft) prune_file_and_folder(filename, self.destination_path) build_state.remove_artifact(aft) if all: build_state.vacuum()
def update_all_source_infos(self): """Fast way to update all source infos without having to build everything. """ with reporter.build("source info update", self): with self.new_build_state() as build_state: to_build = self.pad.get_all_roots() while to_build: source = to_build.pop() with reporter.process_source(source): prog = self.get_build_program(source, build_state) self.update_source_info(prog, build_state) to_build.extend(prog.iter_child_sources()) build_state.prune_source_infos()
def prune(self, all=False): """This cleans up data left in the build folder that does not correspond to known artifacts. """ with reporter.build(all and 'clean' or 'prune', self): with self.new_build_state() as build_state: for aft in build_state.iter_unreferenced_artifacts(all=all): reporter.report_pruned_artifact(aft) filename = build_state.get_destination_filename(aft) prune_file_and_folder(filename, self.destination_path) build_state.remove_artifact(aft) if all: build_state.vacuum()
def build_all(self): """Builds the entire tree. Returns the number of failures.""" failures = 0 path_cache = PathCache(self.env) with reporter.build('build', self): self.env.plugin_controller.emit('before-build-all', builder=self) to_build = self.get_initial_build_queue() while to_build: source = to_build.popleft() prog, build_state = self.build(source, path_cache=path_cache) self.extend_build_queue(to_build, prog) failures += len(build_state.failed_artifacts) self.env.plugin_controller.emit('after-build-all', builder=self) if failures: reporter.report_build_all_failure(failures) return failures
def prune(self, all=False): """This cleans up data left in the build folder that does not correspond to known artifacts. """ with reporter.build(all and "clean" or "prune", self): self.env.plugin_controller.emit("before_prune", builder=self, all=all) with self.new_build_state() as build_state: for aft in build_state.iter_unreferenced_artifacts(all=all): reporter.report_pruned_artifact(aft) filename = build_state.get_destination_filename(aft) prune_file_and_folder(filename, self.destination_path) build_state.remove_artifact(aft) build_state.prune_source_infos() if all: build_state.vacuum() self.env.plugin_controller.emit("after_prune", builder=self, all=all)
def prune(self, all=False): """This cleans up data left in the build folder that does not correspond to known artifacts. """ path_cache = PathCache(self.env) with reporter.build(all and "clean" or "prune", self): self.env.plugin_controller.emit("before-prune", builder=self, all=all) with self.new_build_state(path_cache=path_cache) as build_state: for aft in build_state.iter_unreferenced_artifacts(all=all): reporter.report_pruned_artifact(aft) filename = build_state.get_destination_filename(aft) prune_file_and_folder(filename, self.destination_path) build_state.remove_artifact(aft) build_state.prune_source_infos() if all: build_state.vacuum() self.env.plugin_controller.emit("after-prune", builder=self, all=all)
def update_all_source_infos(self): """Fast way to update all source infos without having to build everything. """ # We keep a dummy connection here that does not do anything which # helps us with the WAL handling. See #144 con = self.connect_to_database() try: with reporter.build("source info update", self): with self.new_build_state() as build_state: to_build = self.get_initial_build_queue() while to_build: source = to_build.popleft() with reporter.process_source(source): prog = self.get_build_program(source, build_state) self.update_source_info(prog, build_state) self.extend_build_queue(to_build, prog) build_state.prune_source_infos() finally: con.close()
def build_all(self): """Builds the entire tree. Returns the number of failures.""" failures = 0 path_cache = PathCache(self.env) # We keep a dummy connection here that does not do anything which # helps us with the WAL handling. See #144 con = self.connect_to_database() try: with reporter.build('build', self): self.env.plugin_controller.emit('before-build-all', builder=self) to_build = self.get_initial_build_queue() while to_build: source = to_build.popleft() prog, build_state = self.build(source, path_cache=path_cache) self.extend_build_queue(to_build, prog) failures += len(build_state.failed_artifacts) self.env.plugin_controller.emit('after-build-all', builder=self) if failures: reporter.report_build_all_failure(failures) return failures finally: con.close()