Exemple #1
0
 def init(self):
     # type: () -> None
     self.build_info = BuildInfo(self.config, self.tags)
     self.imagedir = '_images'
     self.current_docname = None
     self.theme = None       # no theme necessary
     self.templates = None   # no template bridge necessary
     self.init_templates()
     self.init_highlighter()
     self.init_css_files()
     self.init_js_files()
     self.use_index = self.get_builder_config('use_index', 'html')
Exemple #2
0
    def get_outdated_docs(self):
        from sphinx.builders.html import BuildInfo
        old = BuildInfo()
        try:
            with open(path.join(self.outdir, '.buildinfo')) as fp:
                old = BuildInfo.load(fp)
        except ValueError:
            self.warn('unsupported build info format in %r, building all' %
                      path.join(self.outdir, '.buildinfo'))
        except Exception:
            pass
        if self.build_info != old:
            for docname in self.env.found_docs:
                yield docname
            return

        if self.templates:
            template_mtime = self.templates.newest_template_mtime()
        else:
            template_mtime = 0
        for docname in self.env.found_docs:
            if docname not in self.env.all_docs:
                yield docname
                continue
            targetname = path.join(self.outdir, 'objects.inv')
            try:
                targetmtime = path.getmtime(targetname)
            except Exception:
                targetmtime = 0
            try:
                srcmtime = max(path.getmtime(self.env.doc2path(docname)),
                               template_mtime)
                if srcmtime > targetmtime:
                    yield docname
            except EnvironmentError:
                # source doesn't exist anymore
                pass
Exemple #3
0
    def get_outdated_docs(self):
        # type: () -> Iterator[str]
        try:
            with open(path.join(self.outdir, '.buildinfo')) as fp:
                buildinfo = BuildInfo.load(fp)

            if self.build_info != buildinfo:
                yield from self.env.found_docs
                return
        except ValueError as exc:
            logger.warning(__('Failed to read build info file: %r'), exc)
        except OSError:
            # ignore errors on reading
            pass

        if self.templates:
            template_mtime = self.templates.newest_template_mtime()
        else:
            template_mtime = 0
        for docname in self.env.found_docs:
            if docname not in self.env.all_docs:
                yield docname
                continue
            targetname = self.get_outfilename(docname)
            try:
                targetmtime = path.getmtime(targetname)
            except Exception:
                targetmtime = 0
            try:
                srcmtime = max(path.getmtime(self.env.doc2path(docname)),
                               template_mtime)
                if srcmtime > targetmtime:
                    yield docname
            except OSError:
                # source doesn't exist anymore
                pass
Exemple #4
0
 def create_build_info(self) -> BuildInfo:
     return BuildInfo(self.config, self.tags, ['html', 'epub'])
Exemple #5
0
 def create_build_info(self):
     # type: () -> BuildInfo
     return BuildInfo(self.config, self.tags, ['html'])