Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
  9. endef
  10. export BROWSER_PYSCRIPT
  11. BROWSER := python -c "$$BROWSER_PYSCRIPT"
  12. help:
  13. @echo "clean - remove all build, test, coverage and Python artifacts"
  14. @echo "clean-build - remove build artifacts"
  15. @echo "clean-pyc - remove Python file artifacts"
  16. @echo "clean-test - remove test and coverage artifacts"
  17. @echo "lint - check style with flake8"
  18. @echo "test - run tests quickly with the default Python"
  19. @echo "test-all - run tests on every Python version with tox"
  20. @echo "coverage - check code coverage quickly with the default Python"
  21. @echo "docs - generate Sphinx HTML documentation, including API docs"
  22. @echo "release - package and upload a release"
  23. @echo "dist - package"
  24. @echo "install - install the package to the active Python's site-packages"
  25. clean: clean-build clean-pyc clean-test
  26. clean-build:
  27. rm -fr build/
  28. rm -fr dist/
  29. rm -fr .eggs/
  30. find . -name '*.egg-info' -exec rm -fr {} +
  31. find . -name '*.egg' -exec rm -f {} +
  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. clean-test:
  38. rm -fr .tox/
  39. rm -f .coverage
  40. rm -fr htmlcov/
  41. lint:
  42. flake8 infclass_muter tests
  43. test:
  44. python setup.py test
  45. test-all:
  46. tox
  47. coverage:
  48. coverage run --source infclass_muter setup.py test
  49. coverage report -m
  50. coverage html
  51. $(BROWSER) htmlcov/index.html
  52. docs:
  53. rm -f docs/infclass_muter.rst
  54. rm -f docs/modules.rst
  55. sphinx-apidoc -o docs/ infclass_muter
  56. $(MAKE) -C docs clean
  57. $(MAKE) -C docs html
  58. $(BROWSER) docs/_build/html/index.html
  59. servedocs: docs
  60. watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
  61. release: clean
  62. python setup.py sdist upload
  63. python setup.py bdist_wheel upload
  64. dist: clean
  65. python setup.py sdist
  66. python setup.py bdist_wheel
  67. ls -l dist
  68. install: clean
  69. python setup.py install