3 SPHINXBUILD = $(PYTHON) -m sphinx
5 DOCHTML = $(DOCDIR)/html
6 DOCTREES = $(DOCDIR)/doctrees
7 ALLSPHINXOPTS = -d $(DOCTREES) $(SPHINXOPTS) $(DOCDIR)
9 FULLVER = pyxattr-$(VERSION)
10 DISTFILE = $(FULLVER).tar.gz
13 RSTFILES = doc/index.rst doc/module.rst doc/news.rst doc/readme.md doc/conf.py
14 PYVERS = 3.4 3.5 3.6 3.7 3.8 3.9
20 $(PYTHON) ./setup.py build_ext --inplace
22 $(DOCHTML)/index.html: $(MODNAME) $(RSTFILES)
23 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DOCHTML)
26 doc: $(DOCHTML)/index.html
28 doc/readme.md: README.md
29 ln -s ../README.md doc/readme.md
32 ln -s ../NEWS doc/news.rst
35 fakeroot $(PYTHON) ./setup.py sdist
39 TDIR=$$(mktemp -d) && \
40 trap "rm -rf $$TDIR" EXIT; \
41 tar xzf dist/$(DISTFILE) -C $$TDIR && \
42 (cd $$TDIR/$(FULLVER) && make doc && make test && make dist) && \
43 echo "All good, you can upload $(DISTFILE)!"
46 @for ver in $(PYVERS); do \
47 for flavour in "" "-dbg"; do \
48 if type python$$ver$$flavour >/dev/null; then \
49 echo Testing with python$$ver$$flavour; \
50 python$$ver$$flavour setup.py build_ext -i; \
51 python$$ver$$flavour -m pytest tests; \
55 @if type pypy3 >/dev/null; then \
56 echo Testing with pypy3; \
57 pypy3 setup.py build_ext -i; \
58 pypy3 -m pytest tests; \
62 python3 setup.py build_ext -i
63 python3 -m pytest tests -v
68 trap 'rm $$TESTFILE' EXIT; \
69 for ver in $(PYVERS) ; do \
70 if type python$$ver >/dev/null; then \
71 echo Benchmarking with python$$ver; \
72 python$$ver ./setup.py build -q; \
73 echo " - set (with override)"; \
74 python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.set('$$TESTFILE', 'user.comment', 'hello')"; \
76 python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.list('$$TESTFILE')"; \
78 python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.get('$$TESTFILE', 'user.comment')"; \
79 echo " - set + remove"; \
80 python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.set('$$TESTFILE', 'user.comment', 'hello'); xattr.remove('$$TESTFILE', 'user.comment')"; \
86 $(MAKE) test CFLAGS="-coverage"
87 lcov --capture --directory . --no-external --output-file coverage.info
88 genhtml coverage.info --output-directory out
91 rm -rf $(DOCHTML) $(DOCTREES)
92 rm -f doc/readme.md doc/news.rst
97 .PHONY: doc test fast-test clean dist distcheck coverage