https://github.com/python/cpython/commit/4e47f8ad6d63cdbdc09df467f14f93fec8af2f9a
commit: 4e47f8ad6d63cdbdc09df467f14f93fec8af2f9a
branch: 3.12
author: Hugo van Kemenade <[email protected]>
committer: hugovk <[email protected]>
date: 2024-06-23T19:47:59Z
summary:
[3.12] Docs makefile/RTD: Use uv if installed (GH-120711) (#120923)
files:
M .readthedocs.yml
M Doc/Makefile
diff --git a/.readthedocs.yml b/.readthedocs.yml
index 898a9ae89dbb92..16eb5cd4ed9899 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -13,6 +13,9 @@ build:
python: "3"
commands:
+ - asdf plugin add uv
+ - asdf install uv latest
+ - asdf global uv latest
- make -C Doc venv html
- mkdir _readthedocs
- mv Doc/build/html _readthedocs/html
diff --git a/Doc/Makefile b/Doc/Makefile
index 1cbfc722b010f5..c70768754834dd 100644
--- a/Doc/Makefile
+++ b/Doc/Makefile
@@ -152,7 +152,7 @@ htmlview: html
.PHONY: ensure-sphinx-autobuild
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
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
@@ -174,10 +174,15 @@ 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 --upgrade pip; \
- $(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
- echo "The venv has been created in the $(VENVDIR) directory"; \
+ if uv --version > /dev/null; 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); \
+ echo "The venv has been created in the $(VENVDIR)
directory"; \
+ fi; \
fi
.PHONY: dist
@@ -235,9 +240,17 @@ dist:
rm -r dist/python-$(DISTVERSION)-docs-texinfo
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
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
.PHONY: serve
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]