PRS: Enable preview rendering on pull requests (#2023)
This commit is contained in:
parent
ba09f18ab7
commit
1a79345130
1
build.py
1
build.py
|
@ -81,6 +81,7 @@ if __name__ == "__main__":
|
|||
confoverrides=config_overrides,
|
||||
warningiserror=args.fail_on_warning,
|
||||
parallel=args.jobs,
|
||||
tags=["internal_builder"],
|
||||
)
|
||||
app.build()
|
||||
|
||||
|
|
|
@ -22,11 +22,25 @@ def _depart_maths():
|
|||
pass # No-op callable for the type checker
|
||||
|
||||
|
||||
def _update_config_for_builder(app: Sphinx):
|
||||
def _update_config_for_builder(app: Sphinx) -> None:
|
||||
app.env.document_ids = {} # For PEPReferenceRoleTitleText
|
||||
if app.builder.name == "dirhtml":
|
||||
app.env.settings["pep_url"] = "../pep-{:0>4}"
|
||||
|
||||
# internal_builder exists if Sphinx is run by build.py
|
||||
if "internal_builder" not in app.tags:
|
||||
app.connect("build-finished", _post_build) # Post-build tasks
|
||||
|
||||
|
||||
def _post_build(app: Sphinx, exception: Exception | None) -> None:
|
||||
from pathlib import Path
|
||||
|
||||
from build import create_index_file
|
||||
|
||||
if exception is not None:
|
||||
return
|
||||
create_index_file(Path(app.outdir), app.builder.name)
|
||||
|
||||
|
||||
def setup(app: Sphinx) -> dict[str, bool]:
|
||||
"""Initialize Sphinx extension."""
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
version: 2
|
||||
|
||||
build:
|
||||
os: ubuntu-20.04
|
||||
tools:
|
||||
python: "3.9"
|
||||
|
||||
python:
|
||||
install:
|
||||
- requirements: requirements.txt
|
||||
|
||||
sphinx:
|
||||
builder: dirhtml
|
||||
|
||||
search:
|
||||
ignore: ['*']
|
Loading…
Reference in New Issue