Infra: makefile/RTD: Use uv if installed (#3791)
This commit is contained in:
parent
c85a956398
commit
3b62de3fac
|
@ -10,6 +10,9 @@ build:
|
||||||
python: "3"
|
python: "3"
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
- asdf plugin add uv
|
||||||
|
- asdf install uv latest
|
||||||
|
- asdf global uv latest
|
||||||
- make dirhtml JOBS=$(nproc) BUILDDIR=_readthedocs/html
|
- make dirhtml JOBS=$(nproc) BUILDDIR=_readthedocs/html
|
||||||
|
|
||||||
sphinx:
|
sphinx:
|
||||||
|
|
24
Makefile
24
Makefile
|
@ -71,16 +71,28 @@ 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)"; \
|
||||||
$(PYTHON) -m venv $(VENVDIR); \
|
if uv --version > /dev/null; then \
|
||||||
$(VENVDIR)/bin/python3 -m pip install -U pip wheel; \
|
uv venv $(VENVDIR); \
|
||||||
$(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \
|
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"; \
|
echo "The venv has been created in the $(VENVDIR) directory"; \
|
||||||
fi
|
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
|
## lint to lint all the files
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: venv
|
lint: 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
|
$(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
|
||||||
|
@ -90,7 +102,7 @@ test: venv
|
||||||
|
|
||||||
## spellcheck to check spelling
|
## spellcheck to check spelling
|
||||||
.PHONY: spellcheck
|
.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 --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install 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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue