Skip to content

Infra: Refactor Makefile #3514

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

Merged
merged 3 commits into from
Nov 3, 2023
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
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