Skip to content

Commit de536ac

Browse files
authored
Infra: Remove GNU make-specific directive from Makefile (#3891)
* Remove GNU make-specific directive from Makefile * Remove deprecated 'make check-links'
1 parent 81c5900 commit de536ac

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

Makefile

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
# You can set these variables from the command line.
44
PYTHON = python3
55
VENVDIR = .venv
6+
UV = uv
67
# synchronise with render.yml -> deploy step
78
BUILDDIR = build
89
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
910
BUILDER = html
1011
JOBS = auto
1112
SOURCES =
13+
REQUIREMENTS = requirements.txt
1214
SPHINXERRORHANDLING = --fail-on-warning --keep-going --warning-file sphinx-warnings.txt
1315

1416
ALLSPHINXOPTS = --builder $(BUILDER) \
@@ -36,7 +38,7 @@ htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
3638
# Arbitrarily selected ephemeral port between 49152–65535
3739
# to avoid conflicts with other processes:
3840
htmllive: SPHINXERRORHANDLING = --re-ignore="/\.idea/|/venv/|/pep-0000.rst|/topic/" --open-browser --delay 0 --port 55302
39-
htmllive: ensure-sphinx-autobuild html
41+
htmllive: _ensure-sphinx-autobuild html
4042

4143
## dirhtml to render PEPs to "index.html" files within "pep-NNNN" directories
4244
.PHONY: dirhtml
@@ -48,11 +50,6 @@ dirhtml: html
4850
linkcheck: BUILDER = linkcheck
4951
linkcheck: html
5052

51-
## check-links (deprecated: use 'make linkcheck' alias instead)
52-
.PHONY: pages
53-
check-links: linkcheck
54-
@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"
55-
5653
## clean to remove the venv and build files
5754
.PHONY: clean
5855
clean: clean-venv
@@ -71,29 +68,36 @@ venv:
7168
echo "To recreate it, remove it first with \`make clean-venv'."; \
7269
else \
7370
echo "Creating venv in $(VENVDIR)"; \
74-
if uv --version > /dev/null; then \
75-
uv venv $(VENVDIR); \
76-
VIRTUAL_ENV=$(VENVDIR) uv pip install -r requirements.txt; \
71+
if $(UV) --version >/dev/null 2>&1; then \
72+
$(UV) venv $(VENVDIR); \
73+
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
7774
else \
7875
$(PYTHON) -m venv $(VENVDIR); \
7976
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
80-
$(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \
77+
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
8178
fi; \
8279
echo "The venv has been created in the $(VENVDIR) directory"; \
8380
fi
8481

85-
define ensure_package
86-
if uv --version > /dev/null; then \
87-
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install $(1); \
82+
.PHONY: _ensure-package
83+
_ensure-package: venv
84+
if $(UV) --version >/dev/null 2>&1; then \
85+
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install $(PACKAGE); \
8886
else \
89-
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install $(1); \
87+
$(VENVDIR)/bin/python3 -m pip install $(PACKAGE); \
9088
fi
91-
endef
89+
90+
.PHONY: _ensure-pre-commit
91+
_ensure-pre-commit:
92+
make _ensure-package PACKAGE=pre-commit
93+
94+
.PHONY: _ensure-sphinx-autobuild
95+
_ensure-sphinx-autobuild:
96+
make _ensure-package PACKAGE=sphinx-autobuild
9297

9398
## lint to lint all the files
9499
.PHONY: lint
95-
lint: venv
96-
$(call ensure_package,pre_commit)
100+
lint: _ensure-pre-commit
97101
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
98102

99103
## test to test the Sphinx extensions for PEPs

0 commit comments

Comments
 (0)