@@ -152,7 +152,7 @@ htmlview: html
152
152
153
153
.PHONY : ensure-sphinx-autobuild
154
154
ensure-sphinx-autobuild : venv
155
- $(VENVDIR ) /bin/sphinx-autobuild --version > /dev/null || $( VENVDIR ) /bin/python3 -m pip install sphinx-autobuild
155
+ $(call ensure_package, sphinx-autobuild)
156
156
157
157
.PHONY : htmllive
158
158
htmllive : SPHINXBUILD = $(VENVDIR ) /bin/sphinx-autobuild
@@ -174,10 +174,15 @@ venv:
174
174
echo " To recreate it, remove it first with \` make clean-venv'." ; \
175
175
else \
176
176
echo " Creating venv in $( VENVDIR) " ; \
177
- $(PYTHON ) -m venv $(VENVDIR ) ; \
178
- $(VENVDIR ) /bin/python3 -m pip install --upgrade pip; \
179
- $(VENVDIR ) /bin/python3 -m pip install -r $(REQUIREMENTS ) ; \
180
- echo " The venv has been created in the $( VENVDIR) directory" ; \
177
+ if uv --version > /dev/null; then \
178
+ uv venv $(VENVDIR ) ; \
179
+ VIRTUAL_ENV=$(VENVDIR ) uv pip install -r $(REQUIREMENTS ) ; \
180
+ else \
181
+ $(PYTHON ) -m venv $(VENVDIR ) ; \
182
+ $(VENVDIR ) /bin/python3 -m pip install --upgrade pip; \
183
+ $(VENVDIR ) /bin/python3 -m pip install -r $(REQUIREMENTS ) ; \
184
+ echo " The venv has been created in the $( VENVDIR) directory" ; \
185
+ fi ; \
181
186
fi
182
187
183
188
.PHONY : dist
@@ -235,9 +240,17 @@ dist:
235
240
rm -r dist/python-$(DISTVERSION)-docs-texinfo
236
241
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
237
242
243
+ define ensure_package
244
+ if uv --version > /dev/null; then \
245
+ $(VENVDIR ) /bin/python3 -m $(1 ) --version > /dev/null || VIRTUAL_ENV=$(VENVDIR ) uv pip install $(1 ) ; \
246
+ else \
247
+ $(VENVDIR ) /bin/python3 -m $(1 ) --version > /dev/null || $(VENVDIR ) /bin/python3 -m pip install $(1 ) ; \
248
+ fi
249
+ endef
250
+
238
251
.PHONY : check
239
252
check : venv
240
- $(VENVDIR ) /bin/python3 -m pre_commit --version > /dev/null || $( VENVDIR ) /bin/python3 -m pip install pre-commit
253
+ $(call ensure_package, pre_commit)
241
254
$(VENVDIR ) /bin/python3 -m pre_commit run --all-files
242
255
243
256
.PHONY : serve
0 commit comments