django_example_ynh/Makefile

59 lines
1.7 KiB
Makefile
Raw Normal View History

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
pip3 install -U poetry
install: check-poetry ## install project via poetry
poetry install
update: install-poetry ## update the sources and installation
poetry update
lint: ## Run code formatters and linter
poetry run flynt --fail-on-change --line_length=${MAX_LINE_LENGTH} django_ynh
poetry run isort --check-only .
poetry run flake8 django_ynh
fix-code-style: ## Fix code formatting
poetry run flynt --line_length=${MAX_LINE_LENGTH} django_ynh
poetry run black --verbose --safe --line-length=${MAX_LINE_LENGTH} --skip-string-normalization django_ynh django_ynh_tests
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
pytest: install ## Run pytest
poetry run python3 ./run_pytest.py
2020-12-23 19:53:13 +01:00
publish: ## Release new version to PyPi
poetry run publish
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