Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option in build.py for Sphinx builders #1988

Merged
merged 3 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ pages: rss
sphinx:
$(SPHINX_BUILD)

fail_on_warning:
# for building Sphinx without a web-server
sphinx-local:
$(SPHINX_BUILD) --build-files

fail-warning:
$(SPHINX_BUILD) --fail-on-warning

check_links:
check-links:
$(SPHINX_BUILD) --check-links
14 changes: 11 additions & 3 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ def create_parser():
parser = argparse.ArgumentParser(description="Build PEP documents")
# alternative builders:
parser.add_argument("-l", "--check-links", action="store_true")
parser.add_argument("-f", "--build-files", action="store_true")
parser.add_argument("-d", "--build-dirs", action="store_true")

# flags / options
parser.add_argument("-f", "--fail-on-warning", action="store_true")
parser.add_argument("-w", "--fail-on-warning", action="store_true")
parser.add_argument("-n", "--nitpicky", action="store_true")
parser.add_argument("-j", "--jobs", type=int, default=1)

Expand All @@ -31,9 +33,15 @@ def create_parser():
doctree_directory = build_directory / ".doctrees"

# builder configuration
sphinx_builder = "dirhtml"
if args.check_links:
if args.build_files:
sphinx_builder = "html"
elif args.build_dirs:
sphinx_builder = "dirhtml"
elif args.check_links:
sphinx_builder = "linkcheck"
else:
# default builder
sphinx_builder = "dirhtml"

# other configuration
config_overrides = {}
Expand Down