Ejemplo n.º 1
0
 def rst(self):
     if self.done['rst']:
         return
     self.done['rst'] = True
     self.eval()
     notebooks = find_files(os.path.join(self.config.eval_dir, '**', '*.ipynb'))
     updated_notebooks = get_updated_files(
         notebooks, self.config.eval_dir, self.config.rst_dir, 'ipynb', 'rst')
     logging.info('%d rst files are outdated', len(updated_notebooks))
     for src, tgt in updated_notebooks:
         logging.info('Convert %s to %s', src, tgt)
         mkdir(os.path.dirname(tgt))
         ipynb2rst(src, tgt)
     prepare_sphinx_env(self.config)
     self._copy_rst()
     self._copy_resources(self.config.src_dir, self.config.rst_dir)
Ejemplo n.º 2
0
    def rst(self):
        self.eval()
        notebooks = find_files(
            os.path.join(self.config.eval_dir, '**', '*.ipynb'))
        updated_notebooks = get_updated_files(notebooks, self.config.eval_dir,
                                              self.config.rst_dir, 'ipynb',
                                              'rst')
        logging.info('%d rst files are outdated', len(updated_notebooks))
        for src, tgt in updated_notebooks:
            logging.info('Convert %s to %s', src, tgt)
            mkdir(os.path.dirname(tgt))
            ipynb2rst(src, tgt)
        # Generate conf.py under rst folder
        prepare_sphinx_env(self.config)
        self._copy_rst()
        self._copy_resources(self.config.src_dir, self.config.rst_dir)

        must_incl_rst_files = get_tgt_files_from_src_pattern(
            self.config.build['rsts'], self.config.rst_dir, 'rst', 'rst')
        self._rm_tgt_files('md', 'rst', self.config.rst_dir,
                           must_incl_rst_files)