| 1 |
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE.txt file. |
| 2 |
|
| 3 |
# This makefile is just a cheatsheet to remind me of some commonly used |
| 4 |
# commands. I generally am executing these commands on Ubuntu, or on WindowsXP |
| 5 |
# with Cygwin binaries at the start of the PATH. |
| 6 |
|
| 7 |
NAME=colorama |
| 8 |
|
| 9 |
help: ## Display help for documented make targets. |
| 10 |
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ |
| 11 |
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-7s\033[0m %s\n", $$1, $$2}' |
| 12 |
|
| 13 |
|
| 14 |
# bootstrap environment |
| 15 |
|
| 16 |
virtualenv=~/.virtualenvs/colorama |
| 17 |
pip=$(virtualenv)/bin/pip |
| 18 |
syspython=python3 |
| 19 |
python=$(virtualenv)/bin/python |
| 20 |
twine=$(virtualenv)/bin/twine |
| 21 |
|
| 22 |
clean: ## Remove build artifacts, .pyc files, virtualenv |
| 23 |
-rm -rf build dist MANIFEST colorama.egg-info $(virtualenv) |
| 24 |
-find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete |
| 25 |
.PHONY: clean |
| 26 |
|
| 27 |
$(virtualenv): |
| 28 |
$(syspython) -m venv --clear $(virtualenv) |
| 29 |
$(pip) install --upgrade pip |
| 30 |
|
| 31 |
venv: $(virtualenv) ## Create or clear a virtualenv |
| 32 |
.PHONY: venv |
| 33 |
|
| 34 |
bootstrap: venv ## Populate the virtualenv |
| 35 |
$(pip) install -r requirements.txt -r requirements-dev.txt |
| 36 |
.PHONY: bootstrap |
| 37 |
|
| 38 |
|
| 39 |
# development |
| 40 |
|
| 41 |
tags: ## Create tags file |
| 42 |
ctags -R ${NAME} |
| 43 |
.PHONY: tags |
| 44 |
|
| 45 |
test: ## Run tests |
| 46 |
$(python) -m unittest discover -p *_test.py |
| 47 |
.PHONY: test |
| 48 |
|
| 49 |
|
| 50 |
# build packages |
| 51 |
|
| 52 |
build: ## Build a release (sdist and wheel) |
| 53 |
$(python) -m build |
| 54 |
.PHONY: build |
| 55 |
|
| 56 |
test-release: build ## Test a built release |
| 57 |
./test-release |
| 58 |
.PHONY: test-release |
| 59 |
|
| 60 |
release: ## Upload a built release |
| 61 |
$(twine) upload dist/colorama-* |
| 62 |
.PHONY: release |