chore: don't use venv activation in makefile

This commit is contained in:
jo 2022-12-07 11:29:21 +01:00 committed by Kyle Robbertze
parent beff69ca5b
commit 2ccd93299a
2 changed files with 15 additions and 27 deletions

View file

@ -1,5 +1,3 @@
.ONESHELL:
.DEFAULT_GOAL := install
SHELL := bash
CPU_CORES := $(shell N=$$(nproc); echo $$(( $$N > 4 ? 4 : $$N )))
@ -24,48 +22,40 @@ SHARED_DEV_REQUIREMENTS = \
VENV = .venv
$(VENV):
python3 -m venv $(VENV)
source $(VENV)/bin/activate
$(MAKE) install
# SETUPTOOLS_ENABLE_FEATURES=legacy-editable is required to work
# around https://github.com/PyCQA/pylint/issues/7306
install: $(VENV)
source $(VENV)/bin/activate
pip install --upgrade pip setuptools wheel
pip install $(SHARED_DEV_REQUIREMENTS)
[[ -z "$(PIP_INSTALL)" ]] || SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install $(PIP_INSTALL)
$(VENV)/bin/pip install --upgrade pip setuptools wheel
$(VENV)/bin/pip install $(SHARED_DEV_REQUIREMENTS)
[[ -z "$(PIP_INSTALL)" ]] || SETUPTOOLS_ENABLE_FEATURES=legacy-editable $(VENV)/bin/pip install $(PIP_INSTALL)
.PHONY: .format
.format: $(VENV)
source $(VENV)/bin/activate
black .
isort . --combine-as --profile black
$(VENV)/bin/black .
$(VENV)/bin/isort . --combine-as --profile black
.PHONY: .format-check
.format-check: $(VENV)
source $(VENV)/bin/activate
black . --check
isort . --combine-as --profile black --check
$(VENV)/bin/black . --check
$(VENV)/bin/isort . --combine-as --profile black --check
.PHONY: .pylint
.pylint: $(VENV)
source $(VENV)/bin/activate
pylint --jobs=$(CPU_CORES) --output-format=colorized --recursive=true $(PYLINT_ARG)
$(VENV)/bin/pylint --jobs=$(CPU_CORES) --output-format=colorized --recursive=true $(PYLINT_ARG)
.PHONY: .mypy
.mypy: $(VENV)
source $(VENV)/bin/activate
mypy $(MYPY_ARG)
$(VENV)/bin/mypy $(MYPY_ARG)
.PHONY: .bandit
.bandit: $(VENV)
source $(VENV)/bin/activate
bandit -r $(BANDIT_ARG)
$(VENV)/bin/bandit -r $(BANDIT_ARG)
.PHONY: .pytest
.pytest: $(VENV)
source $(VENV)/bin/activate
pytest -v \
$(VENV)/bin/pytest -v \
--numprocesses=$(CPU_CORES) \
--color=yes \
--cov-config=pyproject.toml \