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 setup.py
15 # This is necessary only if you want to automatically produce a new
16 # _version.py file from the current git history (without doing a build).
19 $(PYTHON) ./setup.py update_version
24 src/allmydata/_version.py:
27 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
28 # since 'setup.py build' always updates the version.
31 $(PYTHON) setup.py build
37 $(PYTHON) setup.py build_for_package
38 find support -name allmydata-tahoe.egg-link -print0 |xargs -0 rm -f --
39 find support -name easy-install.pth -print0 |xargs -0 sed -i 's|^.*/src$||'
42 # create component pkg
43 pkgbuild --root $(shell pwd) \
44 --identifier com.leastauthority.tahoe \
45 --version $(shell $(PYTHON) ./setup.py --version) \
46 --ownership recommended \
47 --install-location /Applications/tahoe.app \
48 --scripts $(shell pwd)/misc/build_helpers/osx/scripts \
51 # create product archive
52 productbuild --distribution $(shell pwd)/misc/build_helpers/osx/Distribution.xml \
60 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
61 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
65 # It is unnecessary to have this depend on build or src/allmydata/_version.py,
66 # since 'setup.py test' always updates the version and builds before testing.
69 $(PYTHON) setup.py test $(TRIALARGS) -s $(TEST)
76 quicktest: make-version
77 $(TAHOE) debug trial $(TRIALARGS) $(TEST)
79 # "make tmpfstest" may be a faster way of running tests on Linux. It works best when you have
80 # at least 330 MiB of free physical memory (to run the whole test suite). Since it uses sudo
81 # to mount/unmount the tmpfs filesystem, it might prompt for your password.
84 time make _tmpfstest 'TMPDIR=$(shell mktemp -d --tmpdir=.)'
87 _tmpfstest: make-version
88 sudo mount -t tmpfs -o size=400m tmpfs '$(TMPDIR)'
89 -$(TAHOE) debug trial --rterrors '--temp-directory=$(TMPDIR)/_trial_temp' $(TRIALARGS) $(TEST)
90 sudo umount '$(TMPDIR)'
94 # code coverage: install the "coverage" package from PyPI, do "make test-coverage" to
95 # do a unit test run with coverage-gathering enabled, then use "make coverage-output" to
96 # generate an HTML report. Also see "make .coverage.el" and misc/coding_tools/coverage.el
97 # for Emacs integration.
99 # This might need to be python-coverage on Debian-based distros.
102 COVERAGEARGS=--branch --source=src/allmydata
104 # --include appeared in coverage-3.4
105 COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
107 .PHONY: test-coverage
110 $(TAHOE) '@$(COVERAGE)' run $(COVERAGEARGS) @tahoe debug trial $(TRIALARGS) $(TEST)
112 .PHONY: coverage-output
115 coverage html -i -d coverage-html $(COVERAGE_OMIT)
116 cp .coverage coverage-html/coverage.data
117 @echo "now point your browser at coverage-html/index.html"
119 .coverage.el: .coverage
120 $(PYTHON) misc/coding_tools/coverage2el.py
124 code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
126 .PHONY: version-and-path
128 $(TAHOE) --version-and-path
130 .PHONY: check-interfaces
132 $(TAHOE) @misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
135 .PHONY: check-miscaptures
137 $(PYTHON) misc/coding_tools/check-miscaptures.py $(SOURCES) 2>&1 |tee miscaptures.txt
142 @$(PYTHON) -OOu `which pyflakes` $(SOURCES) |sort |uniq
147 $(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
152 -$(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
156 doc-checks: check-rst
160 @for x in `find *.rst docs -name "*.rst"`; do rst2html -v $${x} >/dev/null; done 2>&1 |grep -v 'Duplicate implicit target name:'
166 @find src -name '*.py' |grep -v /build/ |wc -l
168 @cat `find src -name '*.py' |grep -v /build/` |wc -l
170 @grep TODO `find src -name '*.py' |grep -v /build/` | wc -l
172 @grep XXX `find src -name '*.py' |grep -v /build/` | wc -l
177 $(TAHOE) @src/allmydata/test/check_memory.py upload
178 $(TAHOE) @src/allmydata/test/check_memory.py upload-self
179 $(TAHOE) @src/allmydata/test/check_memory.py upload-POST
180 $(TAHOE) @src/allmydata/test/check_memory.py download
181 $(TAHOE) @src/allmydata/test/check_memory.py download-GET
182 $(TAHOE) @src/allmydata/test/check_memory.py download-GET-slow
183 $(TAHOE) @src/allmydata/test/check_memory.py receive
185 .PHONY: check-memory-once
186 check-memory-once: .built
188 $(TAHOE) @src/allmydata/test/check_memory.py $(MODE)
190 # The check-speed target uses a pre-established client node to run a canned
191 # set of performance tests against a test network that is also
192 # pre-established (probably on a remote machine). Provide it with the path to
193 # a local directory where this client node has been created (and populated
194 # with the necessary FURLs of the test network). This target will start that
195 # client with the current code and then run the tests. Afterwards it will
198 # The 'sleep 5' is in there to give the new client a chance to connect to its
199 # storageservers, since check_speed.py has no good way of doing that itself.
203 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
204 @echo "stopping any leftover client code"
205 -$(TAHOE) stop $(TESTCLIENTDIR)
206 $(TAHOE) start $(TESTCLIENTDIR)
208 $(TAHOE) @src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
209 $(TAHOE) stop $(TESTCLIENTDIR)
211 # The check-grid target also uses a pre-established client node, along with a
212 # long-term directory that contains some well-known files. See the docstring
213 # in src/allmydata/test/check_grid.py to see how to set this up.
216 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
217 $(TAHOE) @src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
219 .PHONY: bench-dirnode
220 bench-dirnode: .built
221 $(TAHOE) @src/allmydata/test/bench_dirnode.py
223 # the provisioning tool runs as a stand-alone webapp server
224 .PHONY: run-provisioning-tool
225 run-provisioning-tool: .built
226 $(TAHOE) @misc/operations_helpers/provisioning/run.py
228 # 'make repl' is a simple-to-type command to get a Python interpreter loop
229 # from which you can type 'import allmydata'
234 .PHONY: test-get-ignore
237 $(PYTHON) misc/build_helpers/test-git-ignore.py
241 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
244 find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
245 diff allfiles.tmp.old allfiles.tmp.new
247 # It would be nice if 'make clean' deleted any automatically-generated
248 # _version.py too, so that 'make clean; make all' could be useable as a
249 # "what the heck is going on, get me back to a clean state', but we need
250 # 'make clean' to work on non-checkout trees without destroying useful information.
251 # Use 'make distclean' instead to delete all generated files.
254 rm -rf build _trial_temp _test_memory .built
255 rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
257 rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
259 rm -rf misc/dependencies/build misc/dependencies/temp
260 rm -rf misc/dependencies/tahoe_deps.egg-info
261 rm -f bin/tahoe bin/tahoe.pyscript
265 rm -rf src/allmydata_tahoe.egg-info
266 rm -f src/allmydata/_version.py
267 rm -f src/allmydata/_appname.py
270 .PHONY: find-trailing-spaces
271 find-trailing-spaces:
272 $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
275 .PHONY: -find-trailing-spaces
276 -find-trailing-spaces:
277 -$(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
280 # The test-desert-island target grabs the tahoe-deps tarball, unpacks it,
281 # does a build, then asserts that the build did not try to download anything
282 # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
283 # support/lib/ directory is gone.
285 .PHONY: fetch-and-unpack-deps
286 fetch-and-unpack-deps:
287 test -f tahoe-deps.tar.gz || wget https://tahoe-lafs.org/source/tahoe-lafs/deps/tahoe-lafs-deps.tar.gz
289 tar xzf tahoe-lafs-deps.tar.gz
291 .PHONY: test-desert-island
293 $(MAKE) fetch-and-unpack-deps
294 $(MAKE) 2>&1 | tee make.out
295 $(PYTHON) misc/build_helpers/check-build.py make.out no-downloads
302 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
303 $(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
305 .PHONY: upload-tarballs
307 @if [ "X${BB_BRANCH}" = "Xmaster" ] || [ "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