| 1 | .PHONY: clean-pyc clean-build docs clean |
| 2 | define BROWSER_PYSCRIPT |
| 3 | import os, webbrowser, sys |
| 4 | try: |
| 5 | from urllib import pathname2url |
| 6 | except: |
| 7 | from urllib.request import pathname2url |
| 8 | |
| 9 | webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) |
| 10 | endef |
| 11 | export BROWSER_PYSCRIPT |
| 12 | BROWSER := python -c "$$BROWSER_PYSCRIPT" |
| 13 | |
| 14 | help: |
| 15 | @echo "clean - remove all build, test, coverage and Python artifacts" |
| 16 | @echo "clean-build - remove build artifacts" |
| 17 | @echo "clean-pyc - remove Python file artifacts" |
| 18 | @echo "clean-test - remove test and coverage artifacts" |
| 19 | @echo "lint - check style with flake8" |
| 20 | @echo "test - run tests quickly with the default Python" |
| 21 | @echo "test-all - run tests on every Python version with tox" |
| 22 | @echo "coverage - check code coverage quickly with the default Python" |
| 23 | @echo "docs - generate Sphinx HTML documentation, including API docs" |
| 24 | @echo "release - package and upload a release" |
| 25 | @echo "dist - package" |
| 26 | @echo "install - install the package to the active Python's site-packages" |
| 27 | |
| 28 | clean: clean-build clean-pyc clean-test |
| 29 | |
| 30 | clean-build: |
| 31 | rm -fr build/ |
| 32 | rm -fr dist/ |
| 33 | rm -fr .eggs/ |
| 34 | find . -name '*.egg-info' -exec rm -fr {} + |
| 35 | find . -name '*.egg' -exec rm -f {} + |
| 36 | |
| 37 | clean-pyc: |
| 38 | find . -name '*.pyc' -exec rm -f {} + |
| 39 | find . -name '*.pyo' -exec rm -f {} + |
| 40 | find . -name '*~' -exec rm -f {} + |
| 41 | find . -name '__pycache__' -exec rm -fr {} + |
| 42 | |
| 43 | clean-test: |
| 44 | rm -fr .tox/ |
| 45 | rm -f .coverage |
| 46 | rm -fr htmlcov/ |
| 47 | |
| 48 | lint: |
| 49 | flake8 infoblox_client |
| 50 | |
| 51 | test: |
| 52 | python setup.py test |
| 53 | |
| 54 | test-all: |
| 55 | tox |
| 56 | |
| 57 | coverage: |
| 58 | coverage run --source infoblox_client setup.py test |
| 59 | coverage report -m |
| 60 | coverage html |
| 61 | $(BROWSER) htmlcov/index.html |
| 62 | |
| 63 | docs: |
| 64 | sphinx-apidoc --force -o docs/ infoblox_client |
| 65 | $(MAKE) -C docs clean |
| 66 | $(MAKE) -C docs html |
| 67 | $(BROWSER) docs/_build/html/index.html |
| 68 | |
| 69 | release: clean |
| 70 | python setup.py sdist upload |
| 71 | python setup.py bdist_wheel upload |
| 72 | |
| 73 | dist: clean |
| 74 | python setup.py sdist |
| 75 | python setup.py bdist_wheel |
| 76 | ls -l dist |
| 77 | |
| 78 | install: clean |
| 79 | python setup.py install |