Skip to content

Commit 45618a9

Browse files
authored
Remove GNU make-specific directive from Makefile (#1362)
1 parent d2a63a9 commit 45618a9

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

Makefile

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
#
33

44
# You can set these variables from the command line.
5-
PYTHON = python3
6-
VENVDIR = ./venv
7-
SPHINXBUILD = $(VENVDIR)/bin/sphinx-build
8-
SPHINXOPTS = --fail-on-warning --keep-going
9-
BUILDDIR = _build
10-
BUILDER = html
11-
JOBS = auto
12-
PAPER =
13-
SPHINXLINT = $(VENVDIR)/bin/sphinx-lint
5+
PYTHON = python3
6+
VENVDIR = ./venv
7+
UV = uv
8+
SPHINXBUILD = $(VENVDIR)/bin/sphinx-build
9+
SPHINXOPTS = --fail-on-warning --keep-going
10+
BUILDDIR = _build
11+
BUILDER = html
12+
JOBS = auto
13+
PAPER =
14+
SPHINXLINT = $(VENVDIR)/bin/sphinx-lint
15+
REQUIREMENTS = requirements.txt
1416

1517
# Internal variables.
1618
PAPEROPT_a4 = --define latex_paper_size=a4
@@ -70,13 +72,13 @@ venv:
7072
ensure-venv:
7173
@if [ ! -d $(VENVDIR) ] ; then \
7274
echo "Creating venv in $(VENVDIR)"; \
73-
if uv --version > /dev/null; then \
74-
uv venv $(VENVDIR); \
75-
VIRTUAL_ENV=$(VENVDIR) uv pip install -r requirements.txt; \
75+
if $(UV) --version >/dev/null 2>&1; then \
76+
$(UV) venv $(VENVDIR); \
77+
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
7678
else \
7779
$(PYTHON) -m venv $(VENVDIR); \
7880
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
79-
$(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \
81+
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
8082
fi; \
8183
echo "The venv has been created in the $(VENVDIR) directory"; \
8284
fi
@@ -180,19 +182,21 @@ check: ensure-venv
180182
# Ignore the tools and venv dirs and check that the default role is not used.
181183
$(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role
182184

183-
.PHONY: lint
184-
lint: venv
185-
if uv --version > /dev/null; then \
186-
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install pre-commit; \
185+
.PHONY: _ensure-package
186+
_ensure-package: venv
187+
if $(UV) --version >/dev/null 2>&1; then \
188+
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install $(PACKAGE); \
187189
else \
188-
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit; \
189-
fi;
190-
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
190+
$(VENVDIR)/bin/python3 -m pip install $(PACKAGE); \
191+
fi
191192

192-
.PHONY: serve
193-
serve:
194-
@echo "The 'serve' target was removed, use 'htmlview' instead" \
195-
"(see https://github.com/python/cpython/issues/80510)"
193+
.PHONY: _ensure-pre-commit
194+
_ensure-pre-commit:
195+
make _ensure-package PACKAGE=pre-commit
196+
197+
.PHONY: lint
198+
lint: _ensure-pre-commit
199+
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
196200

197201
include/branches.csv: include/release-cycle.json
198202
$(VENVDIR)/bin/python3 _tools/generate_release_cycle.py

0 commit comments

Comments
 (0)