Infra: makefile/RTD: Use uv if installed (#3791)
This commit is contained in:
parent
c85a956398
commit
3b62de3fac
|
@ -10,6 +10,9 @@ build:
|
|||
python: "3"
|
||||
|
||||
commands:
|
||||
- asdf plugin add uv
|
||||
- asdf install uv latest
|
||||
- asdf global uv latest
|
||||
- make dirhtml JOBS=$(nproc) BUILDDIR=_readthedocs/html
|
||||
|
||||
sphinx:
|
||||
|
|
24
Makefile
24
Makefile
|
@ -71,16 +71,28 @@ venv:
|
|||
echo "To recreate it, remove it first with \`make clean-venv'."; \
|
||||
else \
|
||||
echo "Creating venv in $(VENVDIR)"; \
|
||||
$(PYTHON) -m venv $(VENVDIR); \
|
||||
$(VENVDIR)/bin/python3 -m pip install -U pip wheel; \
|
||||
$(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \
|
||||
if uv --version > /dev/null; then \
|
||||
uv venv $(VENVDIR); \
|
||||
VIRTUAL_ENV=$(VENVDIR) uv pip install -r requirements.txt; \
|
||||
else \
|
||||
$(PYTHON) -m venv $(VENVDIR); \
|
||||
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
|
||||
$(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \
|
||||
fi; \
|
||||
echo "The venv has been created in the $(VENVDIR) directory"; \
|
||||
fi
|
||||
|
||||
.PHONY: ensure-pre-commit
|
||||
ensure-pre-commit: venv
|
||||
if uv --version > /dev/null; then \
|
||||
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install pre-commit; \
|
||||
else \
|
||||
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit; \
|
||||
fi;
|
||||
|
||||
## lint to lint all the files
|
||||
.PHONY: lint
|
||||
lint: venv
|
||||
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit
|
||||
lint: ensure-pre-commit
|
||||
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
|
||||
|
||||
## test to test the Sphinx extensions for PEPs
|
||||
|
@ -90,7 +102,7 @@ test: venv
|
|||
|
||||
## spellcheck to check spelling
|
||||
.PHONY: spellcheck
|
||||
spellcheck: venv
|
||||
spellcheck: ensure-pre-commit
|
||||
$(VENVDIR)/bin/python3 -m pre_commit --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install pre-commit
|
||||
$(VENVDIR)/bin/python3 -m pre_commit run --all-files --hook-stage manual codespell
|
||||
|
||||
|
|
Loading…
Reference in New Issue