Infra: Fix `make clean htmllive` (#3813)
This commit is contained in:
parent
0a803fec89
commit
44ec9be8bd
19
Makefile
19
Makefile
|
@ -28,7 +28,7 @@ htmlview: html
|
||||||
|
|
||||||
.PHONY: ensure-sphinx-autobuild
|
.PHONY: ensure-sphinx-autobuild
|
||||||
ensure-sphinx-autobuild: venv
|
ensure-sphinx-autobuild: venv
|
||||||
$(VENVDIR)/bin/sphinx-autobuild --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install sphinx-autobuild
|
$(call ensure_package,sphinx-autobuild)
|
||||||
|
|
||||||
## htmllive to rebuild and reload HTML files in your browser
|
## htmllive to rebuild and reload HTML files in your browser
|
||||||
.PHONY: htmllive
|
.PHONY: htmllive
|
||||||
|
@ -82,17 +82,18 @@ venv:
|
||||||
echo "The venv has been created in the $(VENVDIR) directory"; \
|
echo "The venv has been created in the $(VENVDIR) directory"; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
.PHONY: ensure-pre-commit
|
define ensure_package
|
||||||
ensure-pre-commit: venv
|
|
||||||
if uv --version > /dev/null; then \
|
if uv --version > /dev/null; then \
|
||||||
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install pre-commit; \
|
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install $(1); \
|
||||||
else \
|
else \
|
||||||
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit; \
|
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install $(1); \
|
||||||
fi;
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
## lint to lint all the files
|
## lint to lint all the files
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: ensure-pre-commit
|
lint: venv
|
||||||
|
$(call ensure_package,pre_commit)
|
||||||
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
|
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
|
||||||
|
|
||||||
## test to test the Sphinx extensions for PEPs
|
## test to test the Sphinx extensions for PEPs
|
||||||
|
@ -102,8 +103,8 @@ test: venv
|
||||||
|
|
||||||
## spellcheck to check spelling
|
## spellcheck to check spelling
|
||||||
.PHONY: spellcheck
|
.PHONY: spellcheck
|
||||||
spellcheck: ensure-pre-commit
|
spellcheck: venv
|
||||||
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit
|
$(call ensure_package,pre_commit)
|
||||||
$(VENVDIR)/bin/python3 -m pre_commit run --all-files --hook-stage manual codespell
|
$(VENVDIR)/bin/python3 -m pre_commit run --all-files --hook-stage manual codespell
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
|
|
Loading…
Reference in New Issue