| 1 |
.PHONY: help .check-pypi-envs .install-poetry update install docs tests build deploy |
| 2 |
|
| 3 |
.DEFAULT_GOAL := help |
| 4 |
|
| 5 |
export PATH := ${HOME}/.local/bin:$(PATH) |
| 6 |
|
| 7 |
IS_POETRY := $(shell pip freeze | grep "poetry==") |
| 8 |
|
| 9 |
CURRENT_VERSION := $(shell poetry version -s) |
| 10 |
|
| 11 |
help: |
| 12 |
@echo "Please use 'make <target>', where <target> is one of" |
| 13 |
@echo "" |
| 14 |
@echo " build builds the project .whl with poetry" |
| 15 |
@echo " deploy deploys the project using poetry (not recommended, only use if really needed)" |
| 16 |
@echo " help outputs this helper" |
| 17 |
@echo " install installs the dependencies in the env" |
| 18 |
@echo " release version=<sem. version> bumps the project version to <sem. version>, using poetry;" |
| 19 |
@echo " Updates also docs/source/conf.py version;" |
| 20 |
@echo " If no version is provided, poetry outputs the current project version" |
| 21 |
@echo " tests run all the tests and linting" |
| 22 |
@echo " update updates the dependencies in poetry.lock" |
| 23 |
@echo "" |
| 24 |
@echo "Check the Makefile to know exactly what each target is doing." |
| 25 |
|
| 26 |
|
| 27 |
.install-poetry: |
| 28 |
@if [ -z ${IS_POETRY} ]; then pip install poetry; fi |
| 29 |
|
| 30 |
update: .install-poetry |
| 31 |
poetry update |
| 32 |
|
| 33 |
install: .install-poetry |
| 34 |
poetry install |
| 35 |
|
| 36 |
docs: .install-poetry |
| 37 |
poetry run sphinx-build -b html docs/source docs/build |
| 38 |
|
| 39 |
format: .install-poetry |
| 40 |
poetry run isort ocpp tests && poetry run black ocpp tests |
| 41 |
|
| 42 |
tests: .install-poetry |
| 43 |
poetry run black --check --diff ocpp tests |
| 44 |
poetry run isort --check-only ocpp tests |
| 45 |
poetry run flake8 ocpp tests |
| 46 |
poetry run py.test -vvv --cov=ocpp --cov-report=term-missing tests/ |
| 47 |
|
| 48 |
build: .install-poetry |
| 49 |
poetry build |
| 50 |
|
| 51 |
release: .install-poetry |
| 52 |
@echo "Please remember to update the CHANGELOG.md, before tagging the release" |
| 53 |
@sed -i ".bkp" "s/release = '${CURRENT_VERSION}'/release = '${version}'/g" docs/source/conf.py |
| 54 |
@poetry version ${version} |
| 55 |
|
| 56 |
deploy: update tests |
| 57 |
poetry publish --build |