mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Combine 'compile_xxx' and 'build_xxx' functions
These are only called from the one location and we already use 'build' to do both building and writing. Given that we intend to simplify the handling of the 'filenames' argument, this makes our lives there much easier. Signed-off-by: Stephen Finucane <stephen@that.guru>
This commit is contained in:
parent
6adbb006f9
commit
9ab21ce51a
@ -340,13 +340,10 @@ class Sphinx:
|
||||
self.phase = BuildPhase.READING
|
||||
try:
|
||||
if force_all:
|
||||
self.builder.compile_all_catalogs()
|
||||
self.builder.build_all()
|
||||
elif filenames:
|
||||
self.builder.compile_specific_catalogs(filenames)
|
||||
self.builder.build_specific(filenames)
|
||||
else:
|
||||
self.builder.compile_update_catalogs()
|
||||
self.builder.build_update()
|
||||
|
||||
self.events.emit('build-finished', None)
|
||||
|
@ -252,6 +252,7 @@ class Builder:
|
||||
message = __('targets for %d po files that are specified') % len(catalogs)
|
||||
self.compile_catalogs(catalogs, message)
|
||||
|
||||
# TODO(stephenfin): This would make more sense as 'compile_outdated_catalogs'
|
||||
def compile_update_catalogs(self) -> None:
|
||||
repo = CatalogRepository(self.srcdir, self.config.locale_dirs,
|
||||
self.config.language, self.config.source_encoding)
|
||||
@ -263,6 +264,8 @@ class Builder:
|
||||
|
||||
def build_all(self) -> None:
|
||||
"""Build all source files."""
|
||||
self.compile_all_catalogs()
|
||||
|
||||
self.build(None, summary=__('all source files'), method='all')
|
||||
|
||||
def build_specific(self, filenames: List[str]) -> None:
|
||||
@ -290,11 +293,15 @@ class Builder:
|
||||
|
||||
docnames.append(docname)
|
||||
|
||||
self.compile_specific_catalogs(filenames)
|
||||
|
||||
self.build(docnames, method='specific',
|
||||
summary=__('%d source files given on command line') % len(docnames))
|
||||
|
||||
def build_update(self) -> None:
|
||||
"""Only rebuild what was changed or added since last build."""
|
||||
self.compile_update_catalogs()
|
||||
|
||||
to_build = self.get_outdated_docs()
|
||||
if isinstance(to_build, str):
|
||||
self.build(['__all__'], to_build)
|
||||
|
Loading…
Reference in New Issue
Block a user