|
| 1 | +SHELL = /usr/bin/env bash |
| 2 | + |
| 3 | +.DEFAULT_GOAL := help |
| 4 | +.PHONY: help |
| 5 | +.PHONY: clean clean-build clean-pyc clean-test |
| 6 | +.PHONY: lint test test-all test-coverage test-coverage-report-console test-coverage-report-html |
| 7 | +.PHONY: dist install |
| 8 | + |
| 9 | +define PRINT_HELP_PYSCRIPT |
| 10 | +import re, sys |
| 11 | + |
| 12 | +for line in sys.stdin: |
| 13 | + match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) |
| 14 | + if match: |
| 15 | + target, help = match.groups() |
| 16 | + print("%-20s %s" % (target, help)) |
| 17 | +endef |
| 18 | +export PRINT_HELP_PYSCRIPT |
| 19 | + |
| 20 | + |
| 21 | +help: |
| 22 | + @echo "Read README.md" |
| 23 | + @echo "" |
| 24 | + @echo "Makefile tasks:" |
| 25 | + @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) |
| 26 | + |
| 27 | +clean: clean-build clean-pyc clean-test ## remove all build, test, lint, coverage and Python artifacts |
| 28 | + |
| 29 | +clean-build: ## remove build artifacts |
| 30 | + rm -rf .eggs/ |
| 31 | + rm -rf build/ |
| 32 | + rm -rf dist/ |
| 33 | + find . -name '*.egg-info' -exec rm -rf {} + |
| 34 | + find . -name '*.egg' -exec rm -f {} + |
| 35 | + |
| 36 | +clean-pyc: ## remove Python file artifacts |
| 37 | + find . -name '*.pyc' -exec rm -f {} + |
| 38 | + find . -name '*.pyo' -exec rm -f {} + |
| 39 | + find . -name '*~' -exec rm -f {} + |
| 40 | + find . -name '__pycache__' -exec rm -rf {} + |
| 41 | + |
| 42 | +clean-test: ## remove test, lint and coverage artifacts |
| 43 | + rm -rf .cache/ |
| 44 | + rm -rf .tox/ |
| 45 | + rm -f .coverage |
| 46 | + rm -rf htmlcov/ |
| 47 | + rm -rf test-reports/ |
| 48 | + rm -rf .mypy_cache/ |
| 49 | + |
| 50 | +lint: ## run tools for code style analysis, static type check, etc |
| 51 | + flake8 --config=setup.cfg fd_gcp tests |
| 52 | + mypy --config-file setup.cfg fd_gcp |
| 53 | + |
| 54 | +test: ## run tests |
| 55 | + python setup.py test |
| 56 | + |
| 57 | +test-all: ## run tests on every Python version with tox |
| 58 | + @echo "TODO: configure tox" |
| 59 | + |
| 60 | +test-coverage: ## run tests and record test coverage |
| 61 | + coverage run setup.py test |
| 62 | + |
| 63 | +test-coverage-report-console: ## print test coverage summary |
| 64 | + coverage report -m |
| 65 | + |
| 66 | +test-coverage-report-html: ## generate test coverage HTML report |
| 67 | + coverage html |
| 68 | + |
| 69 | +dist: clean ## builds source and wheel package |
| 70 | + python setup.py sdist |
| 71 | + python setup.py bdist_wheel |
| 72 | + ls -l dist |
| 73 | + |
| 74 | +install: clean ## install the package to the active Python's site-packages |
| 75 | + python setup.py install |
0 commit comments