Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 60c44ed

Browse files
[3.13] gh-122661: Remove GNU make-specific directive from Doc/Makefile (GH-122662) (#122668)
Co-authored-by: Libor Martínek <[email protected]>
1 parent 3ba75ae commit 60c44ed

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

Doc/Makefile

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# You can set these variables from the command line.
77
PYTHON = python3
88
VENVDIR = ./venv
9+
UV = uv
910
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
1011
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
1112
JOBS = auto
@@ -150,14 +151,10 @@ gettext: build
150151
htmlview: html
151152
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"
152153

153-
.PHONY: ensure-sphinx-autobuild
154-
ensure-sphinx-autobuild: venv
155-
$(call ensure_package,sphinx-autobuild)
156-
157154
.PHONY: htmllive
158155
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
159156
htmllive: SPHINXOPTS = --re-ignore="/venv/" --open-browser --delay 0
160-
htmllive: ensure-sphinx-autobuild html
157+
htmllive: _ensure-sphinx-autobuild html
161158

162159
.PHONY: clean
163160
clean: clean-venv
@@ -174,15 +171,15 @@ venv:
174171
echo "To recreate it, remove it first with \`make clean-venv'."; \
175172
else \
176173
echo "Creating venv in $(VENVDIR)"; \
177-
if uv --version > /dev/null; then \
178-
uv venv $(VENVDIR); \
179-
VIRTUAL_ENV=$(VENVDIR) uv pip install -r $(REQUIREMENTS); \
174+
if $(UV) --version >/dev/null 2>&1; then \
175+
$(UV) venv $(VENVDIR); \
176+
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
180177
else \
181178
$(PYTHON) -m venv $(VENVDIR); \
182179
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
183180
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
184-
echo "The venv has been created in the $(VENVDIR) directory"; \
185181
fi; \
182+
echo "The venv has been created in the $(VENVDIR) directory"; \
186183
fi
187184

188185
.PHONY: dist
@@ -240,17 +237,24 @@ dist:
240237
rm -r dist/python-$(DISTVERSION)-docs-texinfo
241238
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
242239

243-
define ensure_package
244-
if uv --version > /dev/null; then \
245-
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install $(1); \
240+
.PHONY: _ensure-package
241+
_ensure-package: venv
242+
if $(UV) --version >/dev/null 2>&1; then \
243+
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install $(PACKAGE); \
246244
else \
247-
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install $(1); \
245+
$(VENVDIR)/bin/python3 -m pip install $(PACKAGE); \
248246
fi
249-
endef
247+
248+
.PHONY: _ensure-pre-commit
249+
_ensure-pre-commit:
250+
make _ensure-package PACKAGE=pre-commit
251+
252+
.PHONY: _ensure-sphinx-autobuild
253+
_ensure-sphinx-autobuild:
254+
make _ensure-package PACKAGE=sphinx-autobuild
250255

251256
.PHONY: check
252-
check: venv
253-
$(call ensure_package,pre_commit)
257+
check: _ensure-pre-commit
254258
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
255259

256260
.PHONY: serve

0 commit comments

Comments
 (0)