diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py index 1947c27b0b6..ac034b9cde7 100644 --- a/sphinx/builders/__init__.py +++ b/sphinx/builders/__init__.py @@ -297,6 +297,7 @@ def build_update(self) -> None: summary=__('targets for %d source files that are out of date') % len(to_build)) + @final def build( self, docnames: Iterable[str] | None, @@ -305,6 +306,21 @@ def build( ) -> None: """Main build method, usually called by a specific ``build_*`` method. + First updates the environment, and then calls + :meth:`!write`. + """ + self._build(docnames, summary, method) + + def _build( + self, + docnames: Iterable[str] | None, + summary: str | None = None, + method: Literal['all', 'specific', 'update'] = 'update', + ) -> None: + """Internal build method. + + This should not be overriden by consumers of this library. + First updates the environment, and then calls :meth:`!write`. """ diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py index 076d6971543..1cbe0aec54d 100644 --- a/sphinx/builders/gettext.py +++ b/sphinx/builders/gettext.py @@ -257,14 +257,14 @@ def _extract_from_template(self) -> None: msg = f'{template}: {exc!r}' raise ThemeError(msg) from exc - def build( + def _build( self, docnames: Iterable[str] | None, summary: str | None = None, method: Literal['all', 'specific', 'update'] = 'update', ) -> None: self._extract_from_template() - super().build(docnames, summary, method) + super()._build(docnames, summary, method) def finish(self) -> None: super().finish()