Beispiel #1
0
 def render(self):
     '''Render and listen for doc changes (watcher events)'''
     while True:
         self.watch_ev.wait()  # Wait for docs changes
         self.watch_ev.clear()
         if self.build() != 0:
             exit_msg('rendering %s. Aborting.' % self.c.sphinx_path)
         self.render_ev.set()
Beispiel #2
0
    def manage(self):
        '''Manage web server, watcher and sphinx docs renderer.'''
        def shutdown_handler():
            log.info('Received SIGTERM signal to shut down!')
            killall(workers)

        if self.build() != 0:
            exit_msg('rendering %s. Aborting.' % self.c.sphinx_path)
        workers = [spawn(self.serve), spawn(self.watch), spawn(self.render)]
        signal(SIGTERM, shutdown_handler)
        joinall(workers)
        exit(0)