]> git.k1024.org Git - pyxattr.git/blob - Makefile
Travis: add python 3.5 and 3.6 to build matrix
[pyxattr.git] / Makefile
1 SPHINXOPTS    = -W
2 SPHINXBUILD   = sphinx-build
3 DOCDIR        = doc
4 DOCHTML       = $(DOCDIR)/html
5 DOCTREES      = $(DOCDIR)/doctrees
6 ALLSPHINXOPTS = -d $(DOCTREES) $(SPHINXOPTS) $(DOCDIR)
7
8 MODNAME = xattr.so
9 RSTFILES = doc/index.rst doc/module.rst NEWS README.rst doc/conf.py
10 PYVERS = 2.4 2.5 2.6 2.7 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7
11 REPS = 5
12
13 all: doc test
14
15 $(MODNAME): xattr.c
16         ./setup.py build_ext --inplace
17
18 $(DOCHTML)/index.html: $(MODNAME) $(RSTFILES)
19         $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCHTML)
20         touch $@
21
22 doc: $(DOCHTML)/index.html
23
24 dist:
25         fakeroot ./setup.py sdist
26
27 test:
28         @for ver in $(PYVERS); do \
29           for flavour in "" "-dbg"; do \
30             if type python$$ver$$flavour >/dev/null; then \
31               echo Testing with python$$ver$$flavour; \
32               python$$ver$$flavour ./setup.py test -q; \
33             fi; \
34           done; \
35         done;
36         @if type pypy >/dev/null; then \
37           echo Testing with pypy; \
38           pypy ./setup.py test -q; \
39         fi
40
41 benchmark: $(MODNAME)
42         @set -e; \
43         TESTFILE=`mktemp`;\
44         trap 'rm $$TESTFILE' EXIT; \
45         for ver in $(PYVERS) ; do \
46             if type python$$ver >/dev/null; then \
47               echo Benchmarking with python$$ver; \
48               python$$ver ./setup.py build -q; \
49               echo "  - set (with override)"; \
50               python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.set('$$TESTFILE', 'user.comment', 'hello')"; \
51               echo "  - list"; \
52               python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.list('$$TESTFILE')"; \
53               echo "  - get"; \
54               python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.get('$$TESTFILE', 'user.comment')"; \
55               echo "  - set + remove"; \
56               python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.set('$$TESTFILE', 'user.comment', 'hello'); xattr.remove('$$TESTFILE', 'user.comment')"; \
57             fi; \
58         done;
59
60 coverage:
61         $(MAKE) clean
62         $(MAKE) test CFLAGS="-coverage"
63         lcov --capture --directory . --output-file coverage.info
64         genhtml coverage.info --output-directory out
65
66 clean:
67         rm -rf $(DOCHTML) $(DOCTREES)
68         rm -f $(MODNAME)
69         rm -f *.so
70         rm -rf build
71
72 .PHONY: doc test clean dist coverage