Debian Codegraph @

Makefile

raw
1 PROJ=celery
2 PGPIDENT="Celery Security Team"
3 PYTHON=python
4 PYTEST=pytest
5 GIT=git
6 TOX=tox
7 ICONV=iconv
8 FLAKE8=flake8
9 PYROMA=pyroma
10 SPHINX2RST=sphinx2rst
11 RST2HTML=rst2html.py
12 DEVNULL=/dev/null
13
14 TESTDIR=t
15
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
25 WORKER_GRAPH="docs/images/worker_graph_full.png"
26
27 all: help
28
29 help:
30 @echo "docs - Build documentation."
31 @echo "test-all - Run tests for all supported python versions."
32 @echo "distcheck ---------- - Check distribution for problems."
33 @echo " test - Run unittests using current python."
34 @echo " lint ------------ - Check codebase for problems."
35 @echo " apicheck - Check API reference coverage."
36 @echo " configcheck - Check configuration reference coverage."
37 @echo " readmecheck - Check README.rst encoding."
38 @echo " contribcheck - Check CONTRIBUTING.rst encoding"
39 @echo " flakes -------- - Check code for syntax and style errors."
40 @echo " flakecheck - Run flake8 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 uncommitted 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 @echo ""
54 @echo "Docker-specific commands:"
55 @echo " docker-build - Build celery docker container."
56 @echo " docker-lint - Run tox -e lint on docker container."
57 @echo " docker-unit-tests - Run unit tests on docker container, use '-- -k <TEST NAME>' for specific test run."
58 @echo " docker-bash - Get a bash shell inside the container."
59 @echo " docker-docs - Build documentation with docker."
60
61 clean: clean-docs clean-pyc clean-build
62
63 clean-dist: clean clean-git-force
64
65 bump:
66 bumpversion patch
67
68 bump-minor:
69 bumpversion minor
70
71 bump-major:
72 bumpversion major
73
74 release:
75 python setup.py register sdist bdist_wheel upload --sign --identity="$(PGPIDENT)"
76
77 Documentation:
78 (cd "$(SPHINX_DIR)"; $(MAKE) html)
79 mv "$(SPHINX_HTMLDIR)" $(DOCUMENTATION)
80
81 docs: clean-docs Documentation
82
83 clean-docs:
84 -rm -rf "$(SPHINX_BUILDDIR)" "$(DOCUMENTATION)"
85
86 lint: flakecheck apicheck configcheck readmecheck
87
88 apicheck:
89 (cd "$(SPHINX_DIR)"; $(MAKE) apicheck)
90
91 configcheck:
92 (cd "$(SPHINX_DIR)"; $(MAKE) configcheck)
93
94 flakecheck:
95 $(FLAKE8) "$(PROJ)" "$(TESTDIR)"
96
97 flakediag:
98 -$(MAKE) flakecheck
99
100 flakes: flakediag
101
102 clean-readme:
103 -rm -f $(README)
104
105 readmecheck-unicode:
106 $(ICONV) -f ascii -t ascii $(README) >/dev/null
107
108 readmecheck-rst:
109 -$(RST2HTML) $(README) >$(DEVNULL)
110
111 readmecheck: readmecheck-unicode readmecheck-rst
112
113 $(README):
114 $(SPHINX2RST) "$(README_SRC)" --ascii > $@
115
116 readme: clean-readme $(README) readmecheck
117
118 clean-contrib:
119 -rm -f "$(CONTRIBUTING)"
120
121 $(CONTRIBUTING):
122 $(SPHINX2RST) "$(CONTRIBUTING_SRC)" > $@
123
124 contrib: clean-contrib $(CONTRIBUTING)
125
126 clean-pyc:
127 -find . -type f -a \( -name "*.pyc" -o -name "*$$py.class" \) | xargs -r rm
128 -find . -type d -name "__pycache__" | xargs -r rm -r
129
130 removepyc: clean-pyc
131
132 clean-build:
133 rm -rf build/ dist/ .eggs/ *.egg-info/ .coverage cover/
134
135 clean-git:
136 $(GIT) clean -xdn
137
138 clean-git-force:
139 $(GIT) clean -xdf
140
141 test-all: clean-pyc
142 $(TOX)
143
144 test:
145 $(PYTHON) setup.py test
146
147 cov:
148 $(PYTEST) -x --cov="$(PROJ)" --cov-report=html
149
150 build:
151 $(PYTHON) setup.py sdist bdist_wheel
152
153 distcheck: lint test clean
154
155 dist: readme contrib clean-dist build
156
157
158 $(WORKER_GRAPH):
159 $(PYTHON) -m celery graph bootsteps | dot -Tpng -o $@
160
161 clean-graph:
162 -rm -f $(WORKER_GRAPH)
163
164 graph: clean-graph $(WORKER_GRAPH)
165
166 authorcheck:
167 git shortlog -se | cut -f2 | extra/release/attribution.py
168
169 .PHONY: docker-build
170 docker-build:
171 @DOCKER_BUILDKIT=1 docker compose -f docker/docker-compose.yml build
172
173 .PHONY: docker-lint
174 docker-lint:
175 @docker compose -f docker/docker-compose.yml run --rm -w /home/developer/celery celery tox -e lint
176
177 .PHONY: docker-unit-tests
178 docker-unit-tests:
179 @docker compose -f docker/docker-compose.yml run --rm -w /home/developer/celery celery tox -e 3.12-unit -- $(filter-out $@,$(MAKECMDGOALS))
180
181 # Integration tests are not fully supported when running in a docker container yet so we allow them to
182 # gracefully fail until fully supported.
183 # TODO: Add documentation (in help command) when fully supported.
184 .PHONY: docker-integration-tests
185 docker-integration-tests:
186 @docker compose -f docker/docker-compose.yml run --rm -w /home/developer/celery celery tox -e 3.12-integration-docker -- --maxfail=1000
187
188 .PHONY: docker-bash
189 docker-bash:
190 @docker compose -f docker/docker-compose.yml run --rm -w /home/developer/celery celery bash
191
192 .PHONY: docker-docs
193 docker-docs:
194 @docker compose -f docker/docker-compose.yml up --build -d docs
195 @echo "Waiting 60 seconds for docs service to build the documentation inside the container..."
196 @timeout 60 sh -c 'until docker logs $$(docker compose -f docker/docker-compose.yml ps -q docs) 2>&1 | \
197 grep "build succeeded"; do sleep 1; done' || \
198 (echo "Error! - run manually: docker compose -f ./docker/docker-compose.yml up --build docs"; \
199 docker compose -f docker/docker-compose.yml logs --tail=50 docs; false)
200 @docker compose -f docker/docker-compose.yml down
201
202 .PHONY: catch-all
203 %: catch-all
204 @: