3
3
# You can set these variables from the command line.
4
4
PYTHON = python3
5
5
VENVDIR = .venv
6
+ UV = uv
6
7
# synchronise with render.yml -> deploy step
7
8
BUILDDIR = build
8
9
SPHINXBUILD = PATH=$(VENVDIR ) /bin:$$PATH sphinx-build
9
10
BUILDER = html
10
11
JOBS = auto
11
12
SOURCES =
13
+ REQUIREMENTS = requirements.txt
12
14
SPHINXERRORHANDLING = --fail-on-warning --keep-going --warning-file sphinx-warnings.txt
13
15
14
16
ALLSPHINXOPTS = --builder $(BUILDER ) \
@@ -36,7 +38,7 @@ htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
36
38
# Arbitrarily selected ephemeral port between 49152–65535
37
39
# to avoid conflicts with other processes:
38
40
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
40
42
41
43
# # dirhtml to render PEPs to "index.html" files within "pep-NNNN" directories
42
44
.PHONY : dirhtml
@@ -48,11 +50,6 @@ dirhtml: html
48
50
linkcheck : BUILDER = linkcheck
49
51
linkcheck : html
50
52
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
-
56
53
# # clean to remove the venv and build files
57
54
.PHONY : clean
58
55
clean : clean-venv
@@ -71,29 +68,36 @@ venv:
71
68
echo " To recreate it, remove it first with \` make clean-venv'." ; \
72
69
else \
73
70
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 ) ; \
77
74
else \
78
75
$(PYTHON ) -m venv $(VENVDIR ) ; \
79
76
$(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 ) ; \
81
78
fi ; \
82
79
echo " The venv has been created in the $( VENVDIR) directory" ; \
83
80
fi
84
81
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 ) ; \
88
86
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 ) ; \
90
88
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
92
97
93
98
# # lint to lint all the files
94
99
.PHONY : lint
95
- lint : venv
96
- $(call ensure_package,pre_commit)
100
+ lint : _ensure-pre-commit
97
101
$(VENVDIR ) /bin/python3 -m pre_commit run --all-files
98
102
99
103
# # test to test the Sphinx extensions for PEPs
0 commit comments