Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. PROJ=celery
  2. PGPIDENT="Celery Security Team"
  3. PYTHON=python
  4. PYTEST=py.test
  5. GIT=git
  6. TOX=tox
  7. ICONV=iconv
  8. FLAKE8=flake8
  9. PEP257=pep257
  10. PYROMA=pyroma
  11. FLAKEPLUS=flakeplus
  12. SPHINX2RST=sphinx2rst
  13. RST2HTML=rst2html.py
  14. DEVNULL=/dev/null
  15. TESTDIR=t
  16. SPHINX_DIR=docs/
  17. SPHINX_BUILDDIR="${SPHINX_DIR}/_build"
  18. README=README.rst
  19. README_SRC="docs/templates/readme.txt"
  20. CONTRIBUTING=CONTRIBUTING.rst
  21. CONTRIBUTING_SRC="docs/contributing.rst"
  22. SPHINX_HTMLDIR="${SPHINX_BUILDDIR}/html"
  23. DOCUMENTATION=Documentation
  24. FLAKEPLUSTARGET=2.7
  25. WORKER_GRAPH="docs/images/worker_graph_full.png"
  26. all: help
  27. help:
  28. @echo "docs - Build documentation."
  29. @echo "test-all - Run tests for all supported python versions."
  30. @echo "distcheck ---------- - Check distribution for problems."
  31. @echo " test - Run unittests using current python."
  32. @echo " lint ------------ - Check codebase for problems."
  33. @echo " apicheck - Check API reference coverage."
  34. @echo " configcheck - Check configuration reference coverage."
  35. @echo " readmecheck - Check README.rst encoding."
  36. @echo " contribcheck - Check CONTRIBUTING.rst encoding"
  37. @echo " flakes -------- - Check code for syntax and style errors."
  38. @echo " flakecheck - Run flake8 on the source code."
  39. @echo " flakepluscheck - Run flakeplus on the source code."
  40. @echo " pep257check - Run pep257 on the source code."
  41. @echo "readme - Regenerate README.rst file."
  42. @echo "contrib - Regenerate CONTRIBUTING.rst file"
  43. @echo "clean-dist --------- - Clean all distribution build artifacts."
  44. @echo " clean-git-force - Remove all uncomitted files."
  45. @echo " clean ------------ - Non-destructive clean"
  46. @echo " clean-pyc - Remove .pyc/__pycache__ files"
  47. @echo " clean-docs - Remove documentation build artifacts."
  48. @echo " clean-build - Remove setup artifacts."
  49. @echo "bump - Bump patch version number."
  50. @echo "bump-minor - Bump minor version number."
  51. @echo "bump-major - Bump major version number."
  52. @echo "release - Make PyPI release."
  53. clean: clean-docs clean-pyc clean-build
  54. clean-dist: clean clean-git-force
  55. bump:
  56. bumpversion patch
  57. bump-minor:
  58. bumpversion minor
  59. bump-major:
  60. bumpversion major
  61. release:
  62. python setup.py register sdist bdist_wheel upload --sign --identity="$(PGPIDENT)"
  63. Documentation:
  64. (cd "$(SPHINX_DIR)"; $(MAKE) html)
  65. mv "$(SPHINX_HTMLDIR)" $(DOCUMENTATION)
  66. docs: clean-docs Documentation
  67. clean-docs:
  68. -rm -rf "$(SPHINX_BUILDDIR)" "$(DOCUMENTATION)"
  69. lint: flakecheck apicheck configcheck readmecheck
  70. apicheck:
  71. (cd "$(SPHINX_DIR)"; $(MAKE) apicheck)
  72. configcheck:
  73. (cd "$(SPHINX_DIR)"; $(MAKE) configcheck)
  74. flakecheck:
  75. # the only way to enable all-1 errors is to ignore one of them.
  76. $(FLAKE8) --ignore=X999 "$(PROJ)" "$(TESTDIR)"
  77. pep257check:
  78. $(PEP257) --ignore=D102,D104,D203,D105 "$(PROJ)"
  79. flakediag:
  80. -$(MAKE) flakecheck
  81. flakepluscheck:
  82. $(FLAKEPLUS) --$(FLAKEPLUSTARGET) "$(PROJ)" "$(TESTDIR)"
  83. flakeplusdiag:
  84. -$(MAKE) flakepluscheck
  85. flakes: flakediag flakeplusdiag pep257check
  86. clean-readme:
  87. -rm -f $(README)
  88. readmecheck-unicode:
  89. $(ICONV) -f ascii -t ascii $(README) >/dev/null
  90. readmecheck-rst:
  91. -$(RST2HTML) $(README) >$(DEVNULL)
  92. readmecheck: readmecheck-unicode readmecheck-rst
  93. $(README):
  94. $(SPHINX2RST) "$(README_SRC)" --ascii > $@
  95. readme: clean-readme $(README) readmecheck
  96. clean-contrib:
  97. -rm -f "$(CONTRIBUTING)"
  98. $(CONTRIBUTING):
  99. $(SPHINX2RST) "$(CONTRIBUTING_SRC)" > $@
  100. contrib: clean-contrib $(CONTRIBUTING)
  101. clean-pyc:
  102. -find . -type f -a \( -name "*.pyc" -o -name "*$$py.class" \) | xargs rm
  103. -find . -type d -name "__pycache__" | xargs rm -r
  104. removepyc: clean-pyc
  105. clean-build:
  106. rm -rf build/ dist/ .eggs/ *.egg-info/ .tox/ .coverage cover/
  107. clean-git:
  108. $(GIT) clean -xdn
  109. clean-git-force:
  110. $(GIT) clean -xdf
  111. test-all: clean-pyc
  112. $(TOX)
  113. test:
  114. $(PYTHON) setup.py test
  115. cov:
  116. $(PYTEST) -x --cov="$(PROJ)" --cov-report=html
  117. build:
  118. $(PYTHON) setup.py sdist bdist_wheel
  119. distcheck: lint test clean
  120. dist: readme contrib clean-dist build
  121. $(WORKER_GRAPH):
  122. $(PYTHON) -m celery graph bootsteps | dot -Tpng -o $@
  123. clean-graph:
  124. -rm -f $(WORKER_GRAPH)
  125. graph: clean-graph $(WORKER_GRAPH)
  126. authorcheck:
  127. git shortlog -se | cut -f2 | extra/release/attribution.py