Infra: Refactor Makefile (#3514)

This commit is contained in:
Hugo van Kemenade 2023-11-03 09:24:48 +02:00 committed by GitHub
parent 502a13a43b
commit 32de30c52e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 13 deletions

View File

@ -56,7 +56,7 @@ jobs:
if: (github.ref == 'refs/heads/main') && (matrix.python-version == '3.x') if: (github.ref == 'refs/heads/main') && (matrix.python-version == '3.x')
uses: JamesIves/github-pages-deploy-action@v4 uses: JamesIves/github-pages-deploy-action@v4
with: with:
folder: build # Synchronise with Makefile -> OUTPUT_DIR folder: build # Synchronise with Makefile -> BUILDDIR
single-commit: true # Delete existing files single-commit: true # Delete existing files
- name: Purge CDN cache - name: Purge CDN cache

View File

@ -3,16 +3,18 @@
# You can set these variables from the command line. # You can set these variables from the command line.
PYTHON = python3 PYTHON = python3
VENVDIR = .venv VENVDIR = .venv
# synchronise with render.yml -> deploy step
BUILDDIR = build
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
BUILDER = html BUILDER = html
JOBS = 8 JOBS = 8
SOURCES = SOURCES =
# synchronise with render.yml -> deploy step
OUTPUT_DIR = build
SPHINXERRORHANDLING = -W --keep-going -w sphinx-warnings.txt SPHINXERRORHANDLING = -W --keep-going -w sphinx-warnings.txt
ALLSPHINXOPTS = -b $(BUILDER) -j $(JOBS) \ ALLSPHINXOPTS = -b $(BUILDER) \
$(SPHINXOPTS) $(SPHINXERRORHANDLING) peps $(OUTPUT_DIR) $(SOURCES) -j $(JOBS) \
$(SPHINXOPTS) $(SPHINXERRORHANDLING) \
peps $(BUILDDIR) $(SOURCES)
## html to render PEPs to "pep-NNNN.html" files ## html to render PEPs to "pep-NNNN.html" files
.PHONY: html .PHONY: html
@ -27,14 +29,17 @@ htmlview: html
## dirhtml to render PEPs to "index.html" files within "pep-NNNN" directories ## dirhtml to render PEPs to "index.html" files within "pep-NNNN" directories
.PHONY: dirhtml .PHONY: dirhtml
dirhtml: BUILDER = dirhtml dirhtml: BUILDER = dirhtml
dirhtml: venv dirhtml: html
$(SPHINXBUILD) $(ALLSPHINXOPTS)
## check-links to check validity of links within PEP sources ## linkcheck to check validity of links within PEP sources
.PHONY: check-links .PHONY: linkcheck
check-links: BUILDER = linkcheck check-links: BUILDER = linkcheck
check-links: venv check-links: html
$(SPHINXBUILD) $(ALLSPHINXOPTS)
## 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 ## clean to remove the venv and build files
.PHONY: clean .PHONY: clean

View File

@ -82,7 +82,7 @@ Check the validity of links within PEP sources (runs the `Sphinx linkchecker
.. code-block:: shell .. code-block:: shell
python build.py --check-links python build.py --check-links
make check-links make linkcheck
``build.py`` usage ``build.py`` usage

View File

@ -6,7 +6,7 @@ build:
python: "3.11" python: "3.11"
commands: commands:
- make dirhtml JOBS=$(nproc) OUTPUT_DIR=_readthedocs/html - make dirhtml JOBS=$(nproc) BUILDDIR=_readthedocs/html
sphinx: sphinx:
builder: dirhtml builder: dirhtml