pocli_export_csv/Makefile

66 lignes
1.7 KiB
Makefile

# -*- mode: makefile-gmake -*-
PYTHON_EXE := python3
.PHONY: clean lint format help
PYTHON_EXE := python3
# Configuration de l'environnement virtuel.
VENV_DIR := venv
VENV_OPT := --system-site-packages
PYTHON_EXE_BASENAME := $(shell basename $(PYTHON_EXE))
PYTHON := $(VENV_DIR)/bin/$(PYTHON_EXE_BASENAME)
PIP := $(VENV_DIR)/bin/pip
help: ## affiche cette aide
@perl -nle'print $& if m{^[a-zA-Z_-]+:[^#]*?###? .*$$}' $(MAKEFILE_LIST) \
| sort | awk 'BEGIN {FS = ":.*?###? "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
init: create-venv update
create-venv: $(PYTHON)
$(PYTHON):
$(PYTHON_EXE) -m venv $(VENV_OPT) $(VENV_DIR)
update:
$(PIP) install --upgrade --requirement requirements.txt
clean: clean-build clean-pyc
clean-build: ### nettoie les fichiers de construction du paquet
rm -rf build/
rm -rf dist/
rm -rf *.egg-info src/*.egg-info
clean-pyc: ### nettoie les fichiers temporaires python
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
clear-venv: ## supprime l'environnement virtuel
-rm -rf $(VENV_DIR)
test: ### lance les tests de l'application
$(PYTHON) -m pytest --cov --cov-report=term:skip-covered
cov: test ### vérifie la couverture de code
$(PYTHON) -m coverage html
@echo open htmlcov/index.html
lint: ### vérifie la syntaxe du code Python
@$(PYTHON) -m flake8 src || \
{ echo "\033[31mErreur !\033[0m Veuillez corriger la syntaxe avec : make format"; false; }
format: ### formate le code Python
$(PYTHON) -m isort src
$(PYTHON) -m black src
build: update ### construit le projet
$(PYTHON) -m build
sbuild: update ### construit le projet
$(PYTHON) -m build --sdist