Skip to content

Commit 209b5b1

Browse files
committed
Simplify requirement install command
Signed-off-by: Filipe Laíns <lains@riseup.net>
1 parent 05084a8 commit 209b5b1

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Doc/Makefile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ JOBS = auto
1313
PAPER =
1414
SOURCES =
1515
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
16-
IS_PYTHON_BUILD = $(if $(shell $(PYTHON) -c 'import sys, sysconfig; sys.exit(sysconfig.is_python_build())'), true, false)
16+
IS_PYTHON_BUILD = $(shell $(PYTHON) -c 'import sysconfig; print("true") if sysconfig.is_python_build() else None')
1717
REQUIREMENTS = requirements.txt
1818
REQUIREMENTS_NO_BUILD = requirements-no-build.txt
1919
SPHINXERRORHANDLING = --fail-on-warning
@@ -168,24 +168,19 @@ clean-venv:
168168

169169
.PHONY: venv
170170
venv:
171+
requirements = -r $(REQUIREMENTS) $(if $(IS_PYTHON_BUILD),,-r $(REQUIREMENTS_NO_BUILD))
171172
@if [ -d $(VENVDIR) ] ; then \
172173
echo "venv already exists."; \
173174
echo "To recreate it, remove it first with \`make clean-venv'."; \
174175
else \
175176
echo "Creating venv in $(VENVDIR)"; \
176177
if $(UV) --version >/dev/null 2>&1; then \
177178
$(UV) venv $(VENVDIR); \
178-
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
179-
if ! $(IS_PYTHON_BUILD); then \
180-
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS_NO_BUILD); \
181-
fi; \
179+
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install $(requirements); \
182180
else \
183181
$(PYTHON) -m venv $(VENVDIR); \
184182
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
185-
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
186-
if ! $(IS_PYTHON_BUILD); then \
187-
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS_NO_BUILD); \
188-
fi; \
183+
$(VENVDIR)/bin/python3 -m pip install $(requirements); \
189184
fi; \
190185
echo "The venv has been created in the $(VENVDIR) directory"; \
191186
fi

0 commit comments

Comments
 (0)