mirror of https://github.com/python/cpython
Docs makefile/RTD: Use uv if installed (#120711)
This commit is contained in:
parent
1ba0bb21ed
commit
bc37ac7b44
|
@ -26,6 +26,9 @@ build:
|
||||||
exit 183;
|
exit 183;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- asdf plugin add uv
|
||||||
|
- asdf install uv latest
|
||||||
|
- asdf global uv latest
|
||||||
- make -C Doc venv html
|
- make -C Doc venv html
|
||||||
- mkdir _readthedocs
|
- mkdir _readthedocs
|
||||||
- mv Doc/build/html _readthedocs/html
|
- mv Doc/build/html _readthedocs/html
|
||||||
|
|
17
Doc/Makefile
17
Doc/Makefile
|
@ -152,7 +152,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)
|
||||||
|
|
||||||
.PHONY: htmllive
|
.PHONY: htmllive
|
||||||
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
|
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
|
||||||
|
@ -174,10 +174,15 @@ 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)"; \
|
||||||
|
if uv --version > /dev/null; then \
|
||||||
|
uv venv $(VENVDIR); \
|
||||||
|
VIRTUAL_ENV=$(VENVDIR) uv pip install -r $(REQUIREMENTS); \
|
||||||
|
else \
|
||||||
$(PYTHON) -m venv $(VENVDIR); \
|
$(PYTHON) -m venv $(VENVDIR); \
|
||||||
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
|
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
|
||||||
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
|
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
|
||||||
echo "The venv has been created in the $(VENVDIR) directory"; \
|
echo "The venv has been created in the $(VENVDIR) directory"; \
|
||||||
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
.PHONY: dist
|
.PHONY: dist
|
||||||
|
@ -235,9 +240,17 @@ dist:
|
||||||
rm -r dist/python-$(DISTVERSION)-docs-texinfo
|
rm -r dist/python-$(DISTVERSION)-docs-texinfo
|
||||||
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
|
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
|
||||||
|
|
||||||
|
define ensure_package
|
||||||
|
if uv --version > /dev/null; then \
|
||||||
|
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || VIRTUAL_ENV=$(VENVDIR) uv pip install $(1); \
|
||||||
|
else \
|
||||||
|
$(VENVDIR)/bin/python3 -m $(1) --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install $(1); \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check: venv
|
check: 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
|
$(VENVDIR)/bin/python3 -m pre_commit run --all-files
|
||||||
|
|
||||||
.PHONY: serve
|
.PHONY: serve
|
||||||
|
|
Loading…
Reference in New Issue