| 1 |
PACKAGE = collections_extended |
| 2 |
VENV = $(shell poetry env info --path) |
| 3 |
|
| 4 |
.PHONY: default |
| 5 |
default: clean deps tests |
| 6 |
|
| 7 |
.PHONY: deps |
| 8 |
deps: |
| 9 |
pip install poetry |
| 10 |
poetry install --remove-untracked |
| 11 |
|
| 12 |
.PHONY: tests |
| 13 |
tests: |
| 14 |
poetry run py.test |
| 15 |
|
| 16 |
.PHONY: testall |
| 17 |
testall: |
| 18 |
poetry run tox |
| 19 |
|
| 20 |
.PHONY: clean |
| 21 |
clean: |
| 22 |
rm --recursive --force build |
| 23 |
rm --recursive --force dist |
| 24 |
rm --recursive --force *.egg-info |
| 25 |
find . -name *.py[co] -delete |
| 26 |
find . -name *~ -delete |
| 27 |
find . -name __pycache__ -delete |
| 28 |
find . -name *,cover -delete |
| 29 |
|
| 30 |
.PHONY: deep-clean |
| 31 |
deep-clean: clean clean-docs |
| 32 |
rm --recursive --force $(VENV) |
| 33 |
rm --recursive --force .eggs |
| 34 |
rm --recursive --force .pytest_cache |
| 35 |
rm --recursive --force .tox |
| 36 |
|
| 37 |
# Linting |
| 38 |
|
| 39 |
.PHONY: lint |
| 40 |
lint: |
| 41 |
poetry run flake8 --statistics --count |
| 42 |
poetry check |
| 43 |
|
| 44 |
.PHONY: fixme-check |
| 45 |
fixme-check: |
| 46 |
! git grep FIXME | grep "^Makefile" --invert-match |
| 47 |
|
| 48 |
.PHONY: coverage |
| 49 |
coverage: |
| 50 |
poetry run coverage run --source $(PACKAGE) --module pytest |
| 51 |
poetry run coverage report --show-missing |
| 52 |
poetry run coverage html |
| 53 |
|
| 54 |
# Publishing |
| 55 |
|
| 56 |
.PHONY: publish |
| 57 |
publish: fixme-check lint testall publish-force |
| 58 |
|
| 59 |
.PHONY: publish-force |
| 60 |
publish-force: |
| 61 |
poetry build |
| 62 |
poetry publish |
| 63 |
git push |
| 64 |
git push --tags |
| 65 |
|
| 66 |
# Docs |
| 67 |
|
| 68 |
DOCS_BUILD = docs/_build |
| 69 |
|
| 70 |
.PHONY: clean-docs |
| 71 |
clean-docs: |
| 72 |
rm --force --recursive $(DOCS_BUILD) |
| 73 |
# rm --force docs/$(PACKAGE).rst |
| 74 |
# rm --force docs/modules.rst |
| 75 |
|
| 76 |
.PHONY: docs |
| 77 |
docs: clean-docs |
| 78 |
poetry run sphinx-build -b dirhtml docs $(DOCS_BUILD)/html |