django-for-runners_ynh/Makefile

65 lines
1.8 KiB
Makefile
Raw Normal View History

2020-12-22 18:55:11 +01:00
SHELL := /bin/bash
2022-09-18 17:35:54 +02:00
MAX_LINE_LENGTH := 100
2020-12-22 18:55:11 +01:00
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
2023-04-02 20:15:56 +02:00
install-base-req: ## Install needed base packages via apt
sudo apt install python3-pip python3-venv
2020-12-22 18:55:11 +01:00
install-poetry: ## install or update poetry
2022-09-19 08:44:32 +02:00
curl -sSL https://install.python-poetry.org | python3 -
2020-12-22 18:55:11 +01:00
install: check-poetry ## install project via poetry
2023-04-02 20:15:56 +02:00
python3 -m venv .venv
2020-12-22 18:55:11 +01:00
poetry install
2022-09-19 08:44:32 +02:00
update: check-poetry ## update the sources and installation and generate "conf/requirements.txt"
2023-04-02 20:15:56 +02:00
python3 -m venv .venv
poetry self update
2022-09-19 08:44:32 +02:00
poetry update -v
2023-04-02 20:15:56 +02:00
poetry install
2021-01-17 11:32:28 +01:00
poetry export -f requirements.txt --output conf/requirements.txt
2020-12-22 18:55:11 +01:00
2022-09-18 17:35:54 +02:00
lint: ## Run code formatters and linter
2023-04-02 20:15:56 +02:00
poetry run darker --check
2022-09-18 17:35:54 +02:00
poetry run isort --check-only .
poetry run flake8 .
fix-code-style: ## Fix code formatting
2023-04-02 20:15:56 +02:00
poetry run darker
2022-09-18 17:35:54 +02:00
poetry run isort .
2021-01-17 11:32:28 +01:00
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
2022-09-18 17:52:34 +02:00
poetry run pytest
2021-01-17 11:32:28 +01:00
local-test: install ## Run local_test.py to run the project locally
poetry run python3 ./local_test.py
2020-12-22 18:55:11 +01:00
local-diff-settings: ## Run "manage.py diffsettings" with local test
poetry run python3 local_test/opt_yunohost/manage.py diffsettings
2022-09-18 18:58:52 +02:00
safety: ## Run https://github.com/pyupio/safety
poetry run safety check --full-report
2020-12-22 18:55:11 +01:00
##############################################################################
.PHONY: help check-poetry install-poetry install update local-test