Skip to content

Commit

Permalink
alternative formulation
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleades committed Jul 28, 2024
1 parent cc49f29 commit 56fedf2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions sphinx/builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.

Check failure on line 321 in sphinx/builders/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W293)

sphinx/builders/__init__.py:321:1: W293 Blank line contains whitespace
This should not be overriden by consumers of this library.
First updates the environment, and then calls
:meth:`!write`.
"""
Expand Down
4 changes: 2 additions & 2 deletions sphinx/builders/gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 56fedf2

Please sign in to comment.