Example #1
0
 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()
Example #2
0
 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()
Example #3
0
 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())
Example #4
0
 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())
Example #5
0
 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)
Example #6
0
 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)
Example #7
0
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)
Example #8
0
 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()
Example #9
0
    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()
Example #10
0
 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()
Example #11
0
 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()
Example #12
0
    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()
Example #13
0
 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
Example #14
0
 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
Example #15
0
    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)
Example #16
0
    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)
Example #17
0
 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()
Example #18
0
 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()