2020-12-23 19:53:13 +01:00
|
|
|
SHELL := /bin/bash
|
|
|
|
MAX_LINE_LENGTH := 119
|
|
|
|
|
|
|
|
all: help
|
|
|
|
|
|
|
|
help:
|
|
|
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9 -]+:.*?## / {printf "\033[36m%-22s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
|
|
|
|
|
|
check-poetry:
|
|
|
|
@if [[ "$(shell poetry --version 2>/dev/null)" == *"Poetry"* ]] ; \
|
|
|
|
then \
|
|
|
|
echo "Poetry found, ok." ; \
|
|
|
|
else \
|
|
|
|
echo 'Please install poetry first, with e.g.:' ; \
|
|
|
|
echo 'make install-poetry' ; \
|
|
|
|
exit 1 ; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
install-poetry: ## install or update poetry
|
2020-12-29 10:53:21 +01:00
|
|
|
pip3 install -U pip
|
2020-12-23 19:53:13 +01:00
|
|
|
pip3 install -U poetry
|
|
|
|
|
|
|
|
install: check-poetry ## install project via poetry
|
|
|
|
poetry install
|
|
|
|
|
2020-12-29 10:53:21 +01:00
|
|
|
update: install-poetry ## update the sources and installation and generate "conf/requirements.txt"
|
|
|
|
poetry run pip install -U pip
|
2020-12-23 19:53:13 +01:00
|
|
|
poetry update
|
2020-12-29 10:53:21 +01:00
|
|
|
poetry export -f requirements.txt --output conf/requirements.txt
|
2020-12-23 19:53:13 +01:00
|
|
|
|
|
|
|
lint: ## Run code formatters and linter
|
2022-04-02 20:07:31 +02:00
|
|
|
poetry run flynt --fail-on-change --line-length=${MAX_LINE_LENGTH} .
|
2020-12-23 19:53:13 +01:00
|
|
|
poetry run isort --check-only .
|
2021-02-28 10:56:42 +01:00
|
|
|
poetry run flake8 .
|
2020-12-23 19:53:13 +01:00
|
|
|
|
|
|
|
fix-code-style: ## Fix code formatting
|
2022-04-02 20:07:31 +02:00
|
|
|
poetry run flynt --line-length=${MAX_LINE_LENGTH} .
|
2020-12-28 20:23:46 +01:00
|
|
|
poetry run black --verbose --safe --line-length=${MAX_LINE_LENGTH} --skip-string-normalization .
|
2020-12-23 19:53:13 +01:00
|
|
|
poetry run isort .
|
|
|
|
|
|
|
|
tox-listenvs: check-poetry ## List all tox test environments
|
|
|
|
poetry run tox --listenvs
|
|
|
|
|
|
|
|
tox: check-poetry ## Run pytest via tox with all environments
|
|
|
|
poetry run tox
|
|
|
|
|
2020-12-28 18:52:29 +01:00
|
|
|
pytest: install ## Run pytest
|
|
|
|
poetry run python3 ./run_pytest.py
|
2020-12-23 19:53:13 +01:00
|
|
|
|
2020-12-28 18:52:29 +01:00
|
|
|
local-test: install ## Run local_test.py to run the project locally
|
|
|
|
poetry run python3 ./local_test.py
|
2020-12-23 19:53:13 +01:00
|
|
|
|
|
|
|
local-diff-settings: ## Run "manage.py diffsettings" with local test
|
|
|
|
poetry run python3 local_test/opt_yunohost/manage.py diffsettings
|
|
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
.PHONY: help check-poetry install-poetry install update local-test
|