chore: don't use venv activation in makefile
This commit is contained in:
parent
beff69ca5b
commit
2ccd93299a
10
api/Makefile
10
api/Makefile
|
@ -9,14 +9,14 @@ PYLINT_ARG := libretime_api
|
||||||
MYPY_ARG := libretime_api
|
MYPY_ARG := libretime_api
|
||||||
BANDIT_ARG := --exclude '*/tests/*' libretime_api || true
|
BANDIT_ARG := --exclude '*/tests/*' libretime_api || true
|
||||||
|
|
||||||
|
export DJANGO_SETTINGS_MODULE=libretime_api.settings.testing
|
||||||
|
|
||||||
format: .format
|
format: .format
|
||||||
lint: .format-check .pylint .mypy .bandit
|
lint: .format-check .pylint .mypy .bandit
|
||||||
clean: .clean
|
clean: .clean
|
||||||
|
|
||||||
test: $(VENV)
|
test: $(VENV)
|
||||||
source $(VENV)/bin/activate
|
$(VENV)/bin/pytest -v \
|
||||||
export DJANGO_SETTINGS_MODULE=libretime_api.settings.testing
|
|
||||||
pytest -v \
|
|
||||||
--numprocesses=$(CPU_CORES) \
|
--numprocesses=$(CPU_CORES) \
|
||||||
--color=yes \
|
--color=yes \
|
||||||
--cov-config=pyproject.toml \
|
--cov-config=pyproject.toml \
|
||||||
|
@ -27,9 +27,7 @@ test: $(VENV)
|
||||||
|
|
||||||
SCHEMA_FILE ?= schema.yml
|
SCHEMA_FILE ?= schema.yml
|
||||||
schema: $(VENV)
|
schema: $(VENV)
|
||||||
source $(VENV)/bin/activate
|
$(VENV)/bin/libretime-api spectacular --file $(SCHEMA_FILE)
|
||||||
export DJANGO_SETTINGS_MODULE=libretime_api.settings.testing
|
|
||||||
libretime-api spectacular --file $(SCHEMA_FILE)
|
|
||||||
if command -v npx > /dev/null; then npx prettier --write $(SCHEMA_FILE); fi
|
if command -v npx > /dev/null; then npx prettier --write $(SCHEMA_FILE); fi
|
||||||
|
|
||||||
schema-foreach-commit:
|
schema-foreach-commit:
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
.ONESHELL:
|
|
||||||
|
|
||||||
.DEFAULT_GOAL := install
|
.DEFAULT_GOAL := install
|
||||||
SHELL := bash
|
SHELL := bash
|
||||||
CPU_CORES := $(shell N=$$(nproc); echo $$(( $$N > 4 ? 4 : $$N )))
|
CPU_CORES := $(shell N=$$(nproc); echo $$(( $$N > 4 ? 4 : $$N )))
|
||||||
|
@ -24,48 +22,40 @@ SHARED_DEV_REQUIREMENTS = \
|
||||||
VENV = .venv
|
VENV = .venv
|
||||||
$(VENV):
|
$(VENV):
|
||||||
python3 -m venv $(VENV)
|
python3 -m venv $(VENV)
|
||||||
source $(VENV)/bin/activate
|
|
||||||
$(MAKE) install
|
$(MAKE) install
|
||||||
|
|
||||||
# SETUPTOOLS_ENABLE_FEATURES=legacy-editable is required to work
|
# SETUPTOOLS_ENABLE_FEATURES=legacy-editable is required to work
|
||||||
# around https://github.com/PyCQA/pylint/issues/7306
|
# around https://github.com/PyCQA/pylint/issues/7306
|
||||||
install: $(VENV)
|
install: $(VENV)
|
||||||
source $(VENV)/bin/activate
|
$(VENV)/bin/pip install --upgrade pip setuptools wheel
|
||||||
pip install --upgrade pip setuptools wheel
|
$(VENV)/bin/pip install $(SHARED_DEV_REQUIREMENTS)
|
||||||
pip install $(SHARED_DEV_REQUIREMENTS)
|
[[ -z "$(PIP_INSTALL)" ]] || SETUPTOOLS_ENABLE_FEATURES=legacy-editable $(VENV)/bin/pip install $(PIP_INSTALL)
|
||||||
[[ -z "$(PIP_INSTALL)" ]] || SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install $(PIP_INSTALL)
|
|
||||||
|
|
||||||
.PHONY: .format
|
.PHONY: .format
|
||||||
.format: $(VENV)
|
.format: $(VENV)
|
||||||
source $(VENV)/bin/activate
|
$(VENV)/bin/black .
|
||||||
black .
|
$(VENV)/bin/isort . --combine-as --profile black
|
||||||
isort . --combine-as --profile black
|
|
||||||
|
|
||||||
.PHONY: .format-check
|
.PHONY: .format-check
|
||||||
.format-check: $(VENV)
|
.format-check: $(VENV)
|
||||||
source $(VENV)/bin/activate
|
$(VENV)/bin/black . --check
|
||||||
black . --check
|
$(VENV)/bin/isort . --combine-as --profile black --check
|
||||||
isort . --combine-as --profile black --check
|
|
||||||
|
|
||||||
.PHONY: .pylint
|
.PHONY: .pylint
|
||||||
.pylint: $(VENV)
|
.pylint: $(VENV)
|
||||||
source $(VENV)/bin/activate
|
$(VENV)/bin/pylint --jobs=$(CPU_CORES) --output-format=colorized --recursive=true $(PYLINT_ARG)
|
||||||
pylint --jobs=$(CPU_CORES) --output-format=colorized --recursive=true $(PYLINT_ARG)
|
|
||||||
|
|
||||||
.PHONY: .mypy
|
.PHONY: .mypy
|
||||||
.mypy: $(VENV)
|
.mypy: $(VENV)
|
||||||
source $(VENV)/bin/activate
|
$(VENV)/bin/mypy $(MYPY_ARG)
|
||||||
mypy $(MYPY_ARG)
|
|
||||||
|
|
||||||
.PHONY: .bandit
|
.PHONY: .bandit
|
||||||
.bandit: $(VENV)
|
.bandit: $(VENV)
|
||||||
source $(VENV)/bin/activate
|
$(VENV)/bin/bandit -r $(BANDIT_ARG)
|
||||||
bandit -r $(BANDIT_ARG)
|
|
||||||
|
|
||||||
.PHONY: .pytest
|
.PHONY: .pytest
|
||||||
.pytest: $(VENV)
|
.pytest: $(VENV)
|
||||||
source $(VENV)/bin/activate
|
$(VENV)/bin/pytest -v \
|
||||||
pytest -v \
|
|
||||||
--numprocesses=$(CPU_CORES) \
|
--numprocesses=$(CPU_CORES) \
|
||||||
--color=yes \
|
--color=yes \
|
||||||
--cov-config=pyproject.toml \
|
--cov-config=pyproject.toml \
|
||||||
|
|
Loading…
Reference in New Issue