2 # NOTE: this Makefile requires GNU make
9 # setup.py will extend sys.path to include our support/lib/... directory
10 # itself. It will also create it in the beginning of the 'develop' command.
12 TAHOE=$(PYTHON) bin/tahoe
13 SOURCES=src/allmydata src/buildtest static misc bin/tahoe-script.template twisted setup.py
15 .PHONY: make-version build
17 # This is necessary only if you want to automatically produce a new
18 # _version.py file from the current git/darcs history.
20 $(PYTHON) ./setup.py update_version
25 src/allmydata/_version.py:
28 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
29 # since 'setup.py build' always updates the version using 'darcsver --count-all-patches'.
31 $(PYTHON) setup.py build
34 # 'make install' will do the following:
35 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
36 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
37 # a different location
42 $(PYTHON) ./setup.py install --single-version-externally-managed \
43 --prefix=$(PREFIX) --record=./tahoe.files
45 $(PYTHON) ./setup.py install --single-version-externally-managed
51 .PHONY: signal-error-deps test check test-coverage quicktest quicktest-coverage
52 .PHONY: coverage-output get-old-coverage-coverage coverage-delta-output
55 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
56 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
60 # use 'make test TRIALARGS=--reporter=bwverbose' from buildbot, to
61 # suppress the ansi color sequences
63 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
64 # since 'setup.py test' always updates the version and builds before testing.
66 $(PYTHON) setup.py test $(TRIALARGS) -s $(TEST)
73 $(TAHOE) debug trial --reporter=bwverbose-coverage $(TEST)
76 $(TAHOE) debug trial $(TRIALARGS) $(TEST)
78 # code-coverage: install the "coverage" package from PyPI, do "make
79 # quicktest-coverage" to do a unit test run with coverage-gathering enabled,
80 # then use "make coverate-output-text" for a brief report, or "make
81 # coverage-output" for a pretty HTML report. Also see "make .coverage.el" and
82 # misc/coding_tools/coverage.el for emacs integration.
86 PYTHONPATH=. $(TAHOE) debug trial --reporter=bwverbose-coverage $(TEST)
87 # on my laptop, "quicktest" takes 239s, "quicktest-coverage" takes 304s
89 # --include appeared in coverage-3.4
90 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
93 coverage html -i -d coverage-html $(COVERAGE_OMIT)
94 cp .coverage coverage-html/coverage.data
95 @echo "now point your browser at coverage-html/index.html"
97 .PHONY: upload-coverage .coverage.el pyflakes count-lines
98 .PHONY: check-memory check-memory-once check-speed check-grid
99 .PHONY: repl test-darcs-boringfile test-clean clean find-trailing-spaces
101 .coverage.el: .coverage
102 $(PYTHON) misc/coding_tools/coverage2el.py
104 # 'upload-coverage' is meant to be run with an UPLOAD_TARGET=host:/dir setting
108 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
111 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
115 rsync -a coverage-html/ $(UPLOAD_TARGET)
116 ssh $(UPLOAD_HOST) make update-tahoe-coverage COVERAGEDIR=$(COVERAGEDIR)
119 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
123 code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
126 $(TAHOE) --version-and-path
129 $(TAHOE) @misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
133 $(PYTHON) misc/coding_tools/check-miscaptures.py $(SOURCES) 2>&1 |tee miscaptures.txt
137 @$(PYTHON) -OOu `which pyflakes` $(SOURCES) |sort |uniq
141 $(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
145 -$(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
148 doc-checks: check-rst
151 @for x in `find *.rst docs -name "*.rst"`; do rst2html -v $${x} >/dev/null; done 2>&1 |grep -v 'Duplicate implicit target name:'
156 @find src -name '*.py' |grep -v /build/ |wc -l
158 @cat `find src -name '*.py' |grep -v /build/` |wc -l
160 @grep TODO `find src -name '*.py' |grep -v /build/` | wc -l
162 @grep XXX `find src -name '*.py' |grep -v /build/` | wc -l
166 $(TAHOE) @src/allmydata/test/check_memory.py upload
167 $(TAHOE) @src/allmydata/test/check_memory.py upload-self
168 $(TAHOE) @src/allmydata/test/check_memory.py upload-POST
169 $(TAHOE) @src/allmydata/test/check_memory.py download
170 $(TAHOE) @src/allmydata/test/check_memory.py download-GET
171 $(TAHOE) @src/allmydata/test/check_memory.py download-GET-slow
172 $(TAHOE) @src/allmydata/test/check_memory.py receive
174 check-memory-once: .built
176 $(TAHOE) @src/allmydata/test/check_memory.py $(MODE)
178 # The check-speed target uses a pre-established client node to run a canned
179 # set of performance tests against a test network that is also
180 # pre-established (probably on a remote machine). Provide it with the path to
181 # a local directory where this client node has been created (and populated
182 # with the necessary FURLs of the test network). This target will start that
183 # client with the current code and then run the tests. Afterwards it will
186 # The 'sleep 5' is in there to give the new client a chance to connect to its
187 # storageservers, since check_speed.py has no good way of doing that itself.
190 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
191 @echo "stopping any leftover client code"
192 -$(TAHOE) stop $(TESTCLIENTDIR)
193 $(TAHOE) start $(TESTCLIENTDIR)
195 $(TAHOE) @src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
196 $(TAHOE) stop $(TESTCLIENTDIR)
198 # The check-grid target also uses a pre-established client node, along with a
199 # long-term directory that contains some well-known files. See the docstring
200 # in src/allmydata/test/check_grid.py to see how to set this up.
202 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
203 $(TAHOE) @src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
205 bench-dirnode: .built
206 $(TAHOE) @src/allmydata/test/bench_dirnode.py
208 # the provisioning tool runs as a stand-alone webapp server
209 run-provisioning-tool: .built
210 $(TAHOE) @misc/operations_helpers/provisioning/run.py
212 # 'make repl' is a simple-to-type command to get a Python interpreter loop
213 # from which you can type 'import allmydata'
217 test-darcs-boringfile:
219 $(PYTHON) misc/build_helpers/test-darcs-boringfile.py
223 $(PYTHON) misc/build_helpers/test-git-ignore.py
226 find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
229 find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
230 diff allfiles.tmp.old allfiles.tmp.new
232 # It would be nice if 'make clean' deleted any automatically-generated
233 # _version.py too, so that 'make clean; make all' could be useable as a
234 # "what the heck is going on, get me back to a clean state', but we need
235 # 'make clean' to work on non-darcs trees without destroying useful information.
237 rm -rf build _trial_temp _test_memory .built
238 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
239 rm -rf src/allmydata_tahoe.egg-info
241 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
243 rm -rf misc/dependencies/build misc/dependencies/temp
244 rm -rf misc/dependencies/tahoe_deps.egg-info
245 rm -f bin/tahoe bin/tahoe.pyscript
247 find-trailing-spaces:
248 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
251 -find-trailing-spaces:
252 -$(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
255 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
256 # does a build, then asserts that the build did not try to download anything
257 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
258 # support/lib/ directory is gone.
260 fetch-and-unpack-deps:
261 test -f tahoe-deps.tar.gz || wget https://tahoe-lafs.org/source/tahoe/deps/tahoe-deps.tar.gz
263 tar xzf tahoe-deps.tar.gz
266 $(MAKE) fetch-and-unpack-deps
267 $(MAKE) 2>&1 | tee make.out
268 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
272 .PHONY: tarballs upload-tarballs
275 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
276 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
279 @if [ "X${BB_BRANCH}" = "Xtrunk" ] || [ "X${BB_BRANCH}" = "X" ]; then for f in dist/allmydata-tahoe-*; do flappclient --furlfile ~/.tahoe-tarball-upload.furl upload-file $$f; done ; else echo not uploading tarballs because this is not trunk but is branch \"${BB_BRANCH}\" ; fi