PRS: Enable preview rendering on pull requests (#2023)

This commit is contained in:
Adam Turner 2022-03-11 15:34:31 +00:00 committed by GitHub
parent ba09f18ab7
commit 1a79345130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 1 deletions

View File

@ -81,6 +81,7 @@ if __name__ == "__main__":
confoverrides=config_overrides,
warningiserror=args.fail_on_warning,
parallel=args.jobs,
tags=["internal_builder"],
)
app.build()

View File

@ -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."""

16
readthedocs.yaml Normal file
View File

@ -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: ['*']