Skip to content

Commit

Permalink
Infra: Refactor Makefile (python#3514)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Nov 3, 2023
1 parent 502a13a commit 32de30c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/render.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
if: (github.ref == 'refs/heads/main') && (matrix.python-version == '3.x')
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build # Synchronise with Makefile -> OUTPUT_DIR
folder: build # Synchronise with Makefile -> BUILDDIR
single-commit: true # Delete existing files

- name: Purge CDN cache
Expand Down
25 changes: 15 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
# You can set these variables from the command line.
PYTHON = python3
VENVDIR = .venv
# synchronise with render.yml -> deploy step
BUILDDIR = build
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
BUILDER = html
JOBS = 8
SOURCES =
# synchronise with render.yml -> deploy step
OUTPUT_DIR = build
SPHINXERRORHANDLING = -W --keep-going -w sphinx-warnings.txt

ALLSPHINXOPTS = -b $(BUILDER) -j $(JOBS) \
$(SPHINXOPTS) $(SPHINXERRORHANDLING) peps $(OUTPUT_DIR) $(SOURCES)
ALLSPHINXOPTS = -b $(BUILDER) \
-j $(JOBS) \
$(SPHINXOPTS) $(SPHINXERRORHANDLING) \
peps $(BUILDDIR) $(SOURCES)

## html to render PEPs to "pep-NNNN.html" files
.PHONY: html
Expand All @@ -27,14 +29,17 @@ htmlview: html
## dirhtml to render PEPs to "index.html" files within "pep-NNNN" directories
.PHONY: dirhtml
dirhtml: BUILDER = dirhtml
dirhtml: venv
$(SPHINXBUILD) $(ALLSPHINXOPTS)
dirhtml: html

## check-links to check validity of links within PEP sources
.PHONY: check-links
## linkcheck to check validity of links within PEP sources
.PHONY: linkcheck
check-links: BUILDER = linkcheck
check-links: venv
$(SPHINXBUILD) $(ALLSPHINXOPTS)
check-links: html

## check-links (deprecated: use 'make linkcheck' alias instead)
.PHONY: pages
check-links: linkcheck
@echo "\033[0;33mWarning:\033[0;31m 'make check-links' \033[0;33mis deprecated, use\033[0;32m 'make linkcheck' \033[0;33malias instead\033[0m"

## clean to remove the venv and build files
.PHONY: clean
Expand Down
2 changes: 1 addition & 1 deletion docs/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Check the validity of links within PEP sources (runs the `Sphinx linkchecker
.. code-block:: shell
python build.py --check-links
make check-links
make linkcheck
``build.py`` usage
Expand Down
2 changes: 1 addition & 1 deletion readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build:
python: "3.11"

commands:
- make dirhtml JOBS=$(nproc) OUTPUT_DIR=_readthedocs/html
- make dirhtml JOBS=$(nproc) BUILDDIR=_readthedocs/html

sphinx:
builder: dirhtml
Expand Down

0 comments on commit 32de30c

Please sign in to comment.