Add config option in `build.py` for Sphinx builders (#1988)
This commit is contained in:
parent
ec52afb543
commit
c69fdbf5e1
8
Makefile
8
Makefile
|
@ -66,8 +66,12 @@ pages: rss
|
||||||
sphinx:
|
sphinx:
|
||||||
$(SPHINX_BUILD)
|
$(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
|
$(SPHINX_BUILD) --fail-on-warning
|
||||||
|
|
||||||
check_links:
|
check-links:
|
||||||
$(SPHINX_BUILD) --check-links
|
$(SPHINX_BUILD) --check-links
|
||||||
|
|
14
build.py
14
build.py
|
@ -10,9 +10,11 @@ def create_parser():
|
||||||
parser = argparse.ArgumentParser(description="Build PEP documents")
|
parser = argparse.ArgumentParser(description="Build PEP documents")
|
||||||
# alternative builders:
|
# alternative builders:
|
||||||
parser.add_argument("-l", "--check-links", action="store_true")
|
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
|
# 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("-n", "--nitpicky", action="store_true")
|
||||||
parser.add_argument("-j", "--jobs", type=int, default=1)
|
parser.add_argument("-j", "--jobs", type=int, default=1)
|
||||||
|
|
||||||
|
@ -31,9 +33,15 @@ if __name__ == "__main__":
|
||||||
doctree_directory = build_directory / ".doctrees"
|
doctree_directory = build_directory / ".doctrees"
|
||||||
|
|
||||||
# builder configuration
|
# builder configuration
|
||||||
sphinx_builder = "dirhtml"
|
if args.build_files:
|
||||||
if args.check_links:
|
sphinx_builder = "html"
|
||||||
|
elif args.build_dirs:
|
||||||
|
sphinx_builder = "dirhtml"
|
||||||
|
elif args.check_links:
|
||||||
sphinx_builder = "linkcheck"
|
sphinx_builder = "linkcheck"
|
||||||
|
else:
|
||||||
|
# default builder
|
||||||
|
sphinx_builder = "dirhtml"
|
||||||
|
|
||||||
# other configuration
|
# other configuration
|
||||||
config_overrides = {}
|
config_overrides = {}
|
||||||
|
|
Loading…
Reference in New Issue