示例#1
0
 def build(self, source):
     """Given a source object, builds it."""
     with self.new_build_state() as build_state:
         with reporter.process_source(source):
             prog = self.get_build_program(source, build_state)
             prog.build()
             return prog
示例#2
0
文件: builder.py 项目: jab/lektor
 def build(self, source):
     """Given a source object, builds it."""
     with self.new_build_state() as build_state:
         with reporter.process_source(source):
             prog = self.get_build_program(source, build_state)
             prog.build()
             return prog
示例#3
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()
示例#4
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()
示例#5
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()
示例#6
0
 def build(self, source):
     """Given a source object, builds it."""
     with self.new_build_state() as build_state:
         with reporter.process_source(source):
             prog = self.get_build_program(source, build_state)
             self.env.plugin_controller.emit(
                 "before_build", builder=self, build_state=build_state, source=source, prog=prog
             )
             self.update_source_info(prog, build_state)
             prog.build()
             self.env.plugin_controller.emit(
                 "after_build", builder=self, build_state=build_state, source=source, prog=prog
             )
             return prog
示例#7
0
 def build(self, source, path_cache=None):
     """Given a source object, builds it."""
     with self.new_build_state(path_cache=path_cache) as build_state:
         with reporter.process_source(source):
             prog = self.get_build_program(source, build_state)
             self.env.plugin_controller.emit(
                 'before-build', builder=self, build_state=build_state,
                 source=source, prog=prog)
             prog.build()
             if build_state.updated_artifacts:
                 self.update_source_info(prog, build_state)
             self.env.plugin_controller.emit(
                 'after-build', builder=self, build_state=build_state,
                 source=source, prog=prog)
             return prog, build_state
示例#8
0
 def build(self, source, path_cache=None):
     """Given a source object, builds it."""
     with self.new_build_state(path_cache=path_cache) as build_state:
         with reporter.process_source(source):
             prog = self.get_build_program(source, build_state)
             self.env.plugin_controller.emit(
                 'before-build', builder=self, build_state=build_state,
                 source=source, prog=prog)
             prog.build()
             if build_state.updated_artifacts:
                 self.update_source_info(prog, build_state)
             self.env.plugin_controller.emit(
                 'after-build', builder=self, build_state=build_state,
                 source=source, prog=prog)
             return prog, build_state
示例#9
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()