From 8f67b15aae90cd514e0a131c5ba8b0ce793e4613 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 4 Aug 2024 17:53:49 +0300 Subject: [PATCH 1/2] Remove GNU make-specific directive from Makefile --- Makefile | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index d005d01bb..2061c40f4 100644 --- a/Makefile +++ b/Makefile @@ -2,15 +2,17 @@ # # You can set these variables from the command line. -PYTHON = python3 -VENVDIR = ./venv -SPHINXBUILD = $(VENVDIR)/bin/sphinx-build -SPHINXOPTS = --fail-on-warning --keep-going -BUILDDIR = _build -BUILDER = html -JOBS = auto -PAPER = -SPHINXLINT = $(VENVDIR)/bin/sphinx-lint +PYTHON = python3 +VENVDIR = ./venv +UV = uv +SPHINXBUILD = $(VENVDIR)/bin/sphinx-build +SPHINXOPTS = --fail-on-warning --keep-going +BUILDDIR = _build +BUILDER = html +JOBS = auto +PAPER = +SPHINXLINT = $(VENVDIR)/bin/sphinx-lint +REQUIREMENTS = requirements.txt # Internal variables. PAPEROPT_a4 = --define latex_paper_size=a4 @@ -70,13 +72,13 @@ venv: ensure-venv: @if [ ! -d $(VENVDIR) ] ; then \ echo "Creating venv in $(VENVDIR)"; \ - if uv --version > /dev/null; then \ - uv venv $(VENVDIR); \ - VIRTUAL_ENV=$(VENVDIR) uv pip install -r requirements.txt; \ + if $(UV) --version >/dev/null 2>&1; then \ + $(UV) venv $(VENVDIR); \ + VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \ else \ $(PYTHON) -m venv $(VENVDIR); \ $(VENVDIR)/bin/python3 -m pip install --upgrade pip; \ - $(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \ + $(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \ fi; \ echo "The venv has been created in the $(VENVDIR) directory"; \ fi @@ -180,13 +182,20 @@ check: ensure-venv # Ignore the tools and venv dirs and check that the default role is not used. $(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role -.PHONY: lint -lint: venv - if uv --version > /dev/null; then \ - $(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install pre-commit; \ +.PHONY: _ensure-package +_ensure-package: venv + if $(UV) --version >/dev/null 2>&1; then \ + VIRTUAL_ENV=$(VENVDIR) $(UV) pip install $(PACKAGE); \ else \ - $(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit; \ - fi; + $(VENVDIR)/bin/python3 -m pip install $(PACKAGE); \ + fi + +.PHONY: _ensure-pre-commit +_ensure-pre-commit: + make _ensure-package PACKAGE=pre-commit + +.PHONY: lint +lint: _ensure-pre-commit $(VENVDIR)/bin/python3 -m pre_commit run --all-files .PHONY: serve From 494e589b51878e29b04ec676cb2f1d32e62aa602 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 4 Aug 2024 18:06:15 +0300 Subject: [PATCH 2/2] Remove 'make serve' stub --- Makefile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Makefile b/Makefile index 2061c40f4..1f8e73e28 100644 --- a/Makefile +++ b/Makefile @@ -198,11 +198,6 @@ _ensure-pre-commit: lint: _ensure-pre-commit $(VENVDIR)/bin/python3 -m pre_commit run --all-files -.PHONY: serve -serve: - @echo "The 'serve' target was removed, use 'htmlview' instead" \ - "(see https://github.com/python/cpython/issues/80510)" - include/branches.csv: include/release-cycle.json $(VENVDIR)/bin/python3 _tools/generate_release_cycle.py