|
| 1 | +.PHONY: clean clean-docs clean-test clean-pyc clean-build dist docs help |
| 2 | +.DEFAULT_GOAL := help |
| 3 | + |
| 4 | +SA:=source activate |
| 5 | +ENV:=hadoop-yarn-api-python-client |
| 6 | + |
| 7 | +help: |
| 8 | + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
| 9 | + |
| 10 | + |
| 11 | +## Setup conda environments |
| 12 | +env: ## Make a dev environment |
| 13 | + -conda env create --file requirements.yml --name $(ENV) |
| 14 | + |
| 15 | +activate: ## Activate the virtualenv (default: hadoop-yarn-api-python-client) |
| 16 | + @echo "$(SA) $(ENV)" |
| 17 | + |
| 18 | +nuke: ## Make clean + remove conda env |
| 19 | + -conda env remove -n $(ENV) -y |
| 20 | + |
| 21 | +## Clean different build artifacts from multiple build phases |
| 22 | + |
| 23 | +clean: clean-build clean-pyc clean-test clean-docs ## remove all build, test, coverage and Python artifacts |
| 24 | + |
| 25 | +clean-build: |
| 26 | + rm -fr build/ |
| 27 | + rm -fr dist/ |
| 28 | + rm -fr .eggs/ |
| 29 | + find . -name '*.egg-info' -exec rm -fr {} + |
| 30 | + find . -name '*.egg' -exec rm -f {} + |
| 31 | + |
| 32 | +clean-pyc: |
| 33 | + find . -name '*.pyc' -exec rm -f {} + |
| 34 | + find . -name '*.pyo' -exec rm -f {} + |
| 35 | + find . -name '*~' -exec rm -f {} + |
| 36 | + find . -name '__pycache__' -exec rm -fr {} + |
| 37 | + |
| 38 | +clean-test: |
| 39 | + rm -fr .tox/ |
| 40 | + rm -f .coverage |
| 41 | + rm -fr htmlcov/ |
| 42 | + rm -fr .pytest_cache |
| 43 | + |
| 44 | +clean-docs: |
| 45 | + $(MAKE) -C docs clean |
| 46 | + |
| 47 | +lint: ## check style with flake8 |
| 48 | + $(SA) $(ENV) && flake8 yarn-api-client itests tests |
| 49 | + |
| 50 | +test: ## run tests quickly with the default Python |
| 51 | + $(SA) $(ENV) && nosetests -v tests |
| 52 | + |
| 53 | +docs: clean-docs ## generate Sphinx HTML documentation, including API docs |
| 54 | + $(SA) $(ENV) && $(MAKE) -C docs html |
| 55 | + |
| 56 | +release: dist ## package and upload a release |
| 57 | + twine upload dist/* |
| 58 | + |
| 59 | +dist: clean ## builds source and wheel package |
| 60 | + $(SA) $(ENV) && python setup.py bdist_wheel |
| 61 | + $(SA) $(ENV) && python setup.py sdist |
| 62 | + ls -l dist |
| 63 | + |
| 64 | +install: clean ## install the package to the active Python's site-packages |
| 65 | + $(SA) $(ENV) && python setup.py install |
0 commit comments