[3.13] gh-122661: Remove GNU make-specific directive from Doc/Makefile (GH-122662) (#122668)

Co-authored-by: Libor Martínek <libas@acco.cz>
This commit is contained in:
Miss Islington (bot) 2024-08-09 13:43:09 +02:00 committed by GitHub
parent 3ba75aeba9
commit 60c44ed975
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@
# 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
UV = uv
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
JOBS = auto JOBS = auto
@ -150,14 +151,10 @@ gettext: build
htmlview: html htmlview: html
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))" $(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"
.PHONY: ensure-sphinx-autobuild
ensure-sphinx-autobuild: venv
$(call ensure_package,sphinx-autobuild)
.PHONY: htmllive .PHONY: htmllive
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
htmllive: SPHINXOPTS = --re-ignore="/venv/" --open-browser --delay 0 htmllive: SPHINXOPTS = --re-ignore="/venv/" --open-browser --delay 0
htmllive: ensure-sphinx-autobuild html htmllive: _ensure-sphinx-autobuild html
.PHONY: clean .PHONY: clean
clean: clean-venv clean: clean-venv
@ -174,15 +171,15 @@ venv:
echo "To recreate it, remove it first with \`make clean-venv'."; \ echo "To recreate it, remove it first with \`make clean-venv'."; \
else \ else \
echo "Creating venv in $(VENVDIR)"; \ echo "Creating venv in $(VENVDIR)"; \
if uv --version > /dev/null; then \ if $(UV) --version >/dev/null 2>&1; then \
uv venv $(VENVDIR); \ $(UV) venv $(VENVDIR); \
VIRTUAL_ENV=$(VENVDIR) uv pip install -r $(REQUIREMENTS); \ VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
else \ else \
$(PYTHON) -m venv $(VENVDIR); \ $(PYTHON) -m venv $(VENVDIR); \
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \ $(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \ $(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
echo "The venv has been created in the $(VENVDIR) directory"; \
fi; \ fi; \
echo "The venv has been created in the $(VENVDIR) directory"; \
fi fi
.PHONY: dist .PHONY: dist
@ -240,17 +237,24 @@ dist:
rm -r dist/python-$(DISTVERSION)-docs-texinfo rm -r dist/python-$(DISTVERSION)-docs-texinfo
rm dist/python-$(DISTVERSION)-docs-texinfo.tar rm dist/python-$(DISTVERSION)-docs-texinfo.tar
define ensure_package .PHONY: _ensure-package
if uv --version > /dev/null; then \ _ensure-package: venv
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install $(1); \ if $(UV) --version >/dev/null 2>&1; then \
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install $(PACKAGE); \
else \ else \
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install $(1); \ $(VENVDIR)/bin/python3 -m pip install $(PACKAGE); \
fi fi
endef
.PHONY: _ensure-pre-commit
_ensure-pre-commit:
make _ensure-package PACKAGE=pre-commit
.PHONY: _ensure-sphinx-autobuild
_ensure-sphinx-autobuild:
make _ensure-package PACKAGE=sphinx-autobuild
.PHONY: check .PHONY: check
check: venv check: _ensure-pre-commit
$(call ensure_package,pre_commit)
$(VENVDIR)/bin/python3 -m pre_commit run --all-files $(VENVDIR)/bin/python3 -m pre_commit run --all-files
.PHONY: serve .PHONY: serve