source: trunk/Makefile

Last change on this file was 906d6ac, checked in by Itamar Turner-Trauring <itamar@…>, at 2020-07-06T17:50:06Z

Switch to flake8 as a better way of running pyflakes.

  • Property mode set to 100644
File size: 7.4 KB
Line 
1
2# NOTE: this Makefile requires GNU make
3
4default:
5        @echo "no default target"
6
7PYTHON=python
8export PYTHON
9PYFLAKES=flake8
10export PYFLAKES
11
12SOURCES=src/allmydata static misc setup.py
13APPNAME=tahoe-lafs
14
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).
17.PHONY: make-version
18make-version:
19        $(PYTHON) ./setup.py update_version
20
21.built:
22        $(MAKE) build
23
24src/allmydata/_version.py:
25        $(MAKE) make-version
26
27# Build OS X pkg packages.
28.PHONY: build-osx-pkg test-osx-pkg upload-osx-pkg
29build-osx-pkg:
30        misc/build_helpers/build-osx-pkg.sh $(APPNAME)
31
32test-osx-pkg:
33        $(PYTHON) misc/build_helpers/test-osx-pkg.py
34
35upload-osx-pkg:
36        # [Failure instance: Traceback: <class 'OpenSSL.SSL.Error'>: [('SSL routines', 'ssl3_read_bytes', 'tlsv1 alert unknown ca'), ('SSL routines', 'ssl3_write_bytes', 'ssl handshake failure')]
37        #
38        # @echo "uploading to ~tahoe-tarballs/OS-X-packages/ via flappserver"
39        # @if [ "X${BB_BRANCH}" = "Xmaster" ] || [ "X${BB_BRANCH}" = "X" ]; then \
40        #   flappclient --furlfile ~/.tahoe-osx-pkg-upload.furl upload-file tahoe-lafs-*-osx.pkg; \
41        #  else \
42        #   echo not uploading tahoe-lafs-osx-pkg because this is not trunk but is branch \"${BB_BRANCH}\" ; \
43        # fi
44
45# code coverage-based testing is disabled temporarily, as we switch to tox.
46# This will eventually be added to a tox environment. The following comments
47# and variable settings are retained as notes for that future effort.
48
49## # code coverage: install the "coverage" package from PyPI, do "make
50## # test-coverage" to do a unit test run with coverage-gathering enabled, then
51## # use "make coverage-output" to generate an HTML report. Also see "make
52## # .coverage.el" and misc/coding_tools/coverage.el for Emacs integration.
53##
54## # This might need to be python-coverage on Debian-based distros.
55## COVERAGE=coverage
56##
57## COVERAGEARGS=--branch --source=src/allmydata
58##
59## # --include appeared in coverage-3.4
60## COVERAGE_OMIT=--include '$(CURDIR)/src/allmydata/*' --omit '$(CURDIR)/src/allmydata/test/*'
61
62
63.PHONY: code-checks
64#code-checks: build version-and-path check-interfaces check-miscaptures -find-trailing-spaces -check-umids pyflakes
65code-checks: check-interfaces check-debugging check-miscaptures -find-trailing-spaces -check-umids pyflakes
66
67.PHONY: check-interfaces
68        $(PYTHON) misc/coding_tools/check-interfaces.py 2>&1 |tee violations.txt
69        @echo
70
71.PHONY: check-debugging
72check-debugging:
73        $(PYTHON) misc/coding_tools/check-debugging.py
74        @echo
75
76.PHONY: check-miscaptures
77check-miscaptures:
78        $(PYTHON) misc/coding_tools/check-miscaptures.py $(SOURCES) 2>&1 |tee miscaptures.txt
79        @echo
80
81.PHONY: pyflakes
82pyflakes:
83        $(PYFLAKES) $(SOURCES) |sort |uniq
84        @echo
85
86.PHONY: check-umids
87check-umids:
88        $(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
89        @echo
90
91.PHONY: -check-umids
92-check-umids:
93        -$(PYTHON) misc/coding_tools/check-umids.py `find $(SOURCES) -name '*.py' -not -name 'old.py'`
94        @echo
95
96.PHONY: doc-checks
97doc-checks: check-rst
98
99.PHONY: check-rst
100check-rst:
101        @for x in `find *.rst docs -name "*.rst"`; do rst2html -v $${x} >/dev/null; done 2>&1 |grep -v 'Duplicate implicit target name:'
102        @echo
103
104.PHONY: count-lines
105count-lines:
106        @echo -n "files: "
107        @find src -name '*.py' |grep -v /build/ |wc -l
108        @echo -n "lines: "
109        @cat `find src -name '*.py' |grep -v /build/` |wc -l
110        @echo -n "TODO: "
111        @grep TODO `find src -name '*.py' |grep -v /build/` | wc -l
112        @echo -n "XXX: "
113        @grep XXX `find src -name '*.py' |grep -v /build/` | wc -l
114
115
116# Here is a list of testing tools that can be run with 'python' from a
117# virtualenv in which Tahoe has been installed. There used to be Makefile
118# targets for each, but the exact path to a suitable python is now up to the
119# developer. But as a hint, after running 'tox', ./.tox/py27/bin/python will
120# probably work.
121
122# src/allmydata/test/bench_dirnode.py
123
124
125# The check-speed and check-grid targets are disabled, since they depend upon
126# the pre-located $(TAHOE) executable that was removed when we switched to
127# tox. They will eventually be resurrected as dedicated tox environments.
128
129# The check-speed target uses a pre-established client node to run a canned
130# set of performance tests against a test network that is also
131# pre-established (probably on a remote machine). Provide it with the path to
132# a local directory where this client node has been created (and populated
133# with the necessary FURLs of the test network). This target will start that
134# client with the current code and then run the tests. Afterwards it will
135# stop the client.
136#
137# The 'sleep 5' is in there to give the new client a chance to connect to its
138# storageservers, since check_speed.py has no good way of doing that itself.
139
140##.PHONY: check-speed
141##check-speed: .built
142##      if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
143##      @echo "stopping any leftover client code"
144##      -$(TAHOE) stop $(TESTCLIENTDIR)
145##      $(TAHOE) start $(TESTCLIENTDIR)
146##      sleep 5
147##      $(TAHOE) @src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
148##      $(TAHOE) stop $(TESTCLIENTDIR)
149
150# The check-grid target also uses a pre-established client node, along with a
151# long-term directory that contains some well-known files. See the docstring
152# in src/allmydata/test/check_grid.py to see how to set this up.
153##.PHONY: check-grid
154##check-grid: .built
155##      if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
156##      $(TAHOE) @src/allmydata/test/check_grid.py $(TESTCLIENTDIR) bin/tahoe
157
158.PHONY: test-get-ignore
159test-git-ignore:
160        $(MAKE)
161        $(PYTHON) misc/build_helpers/test-git-ignore.py
162
163.PHONY: test-clean
164test-clean:
165        find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old
166        $(MAKE)
167        $(MAKE) distclean
168        find . |grep -vEe "allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new
169        diff allfiles.tmp.old allfiles.tmp.new
170
171# It would be nice if 'make clean' deleted any automatically-generated
172# _version.py too, so that 'make clean; make all' could be useable as a
173# "what the heck is going on, get me back to a clean state', but we need
174# 'make clean' to work on non-checkout trees without destroying useful information.
175# Use 'make distclean' instead to delete all generated files.
176.PHONY: clean
177clean:
178        rm -rf build _trial_temp _test_memory .built
179        rm -f `find src *.egg -name '*.so' -or -name '*.pyc'`
180        rm -rf support dist
181        rm -rf `ls -d *.egg | grep -vEe"setuptools-|setuptools_darcs-|darcsver-"`
182        rm -rf *.pyc
183        rm -f bin/tahoe bin/tahoe.pyscript
184        rm -f *.pkg
185
186.PHONY: distclean
187distclean: clean
188        rm -rf src/*.egg-info
189        rm -f src/allmydata/_version.py
190        rm -f src/allmydata/_appname.py
191
192
193.PHONY: find-trailing-spaces
194find-trailing-spaces:
195        $(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
196        @echo
197
198.PHONY: -find-trailing-spaces
199-find-trailing-spaces:
200        -$(PYTHON) misc/coding_tools/find-trailing-spaces.py -r $(SOURCES)
201        @echo
202
203.PHONY: fetch-and-unpack-deps
204fetch-and-unpack-deps:
205        @echo "test-and-unpack-deps is obsolete"
206
207.PHONY: test-desert-island
208test-desert-island:
209        @echo "test-desert-island is obsolete"
210
211.PHONY: test-pip-install
212test-pip-install:
213        @echo "test-pip-install is obsolete"
214
215# TARBALL GENERATION
216.PHONY: tarballs
217tarballs: # delegated to tox, so setup.py can update setuptools if needed
218        tox -e tarballs
219
220.PHONY: upload-tarballs
221upload-tarballs:
222        @if [ "X${BB_BRANCH}" = "Xmaster" ] || [ "X${BB_BRANCH}" = "X" ]; then for f in dist/*; 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
Note: See TracBrowser for help on using the repository browser.