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
29 fakeroot $(PYTHON) ./setup.py sdist
33 TDIR=$$(mktemp -d) && \
34 trap "rm -rf $$TDIR" EXIT; \
35 tar xzf dist/$(DISTFILE) -C $$TDIR && \
36 (cd $$TDIR/$(FULLVER) && make doc && make test && make dist) && \
37 echo "All good, you can upload $(DISTFILE)!"
40 @for ver in $(PYVERS); do \
41 for flavour in "" "-dbg"; do \
42 if type python$$ver$$flavour >/dev/null; then \
43 echo Testing with python$$ver$$flavour; \
44 python$$ver$$flavour setup.py build_ext -i; \
45 python$$ver$$flavour -m pytest tests; \
49 @if type pypy3 >/dev/null; then \
50 echo Testing with pypy3; \
51 pypy3 setup.py build_ext -i; \
52 pypy3 -m pytest tests; \
56 python3 setup.py build_ext -i
57 python3 -m pytest tests -v
62 trap 'rm $$TESTFILE' EXIT; \
63 for ver in $(PYVERS) ; do \
64 if type python$$ver >/dev/null; then \
65 echo Benchmarking with python$$ver; \
66 python$$ver ./setup.py build -q; \
67 echo " - set (with override)"; \
68 python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.set('$$TESTFILE', 'user.comment', 'hello')"; \
70 python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.list('$$TESTFILE')"; \
72 python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.get('$$TESTFILE', 'user.comment')"; \
73 echo " - set + remove"; \
74 python$$ver -m timeit -r $(REPS) -s 'import xattr' "xattr.set('$$TESTFILE', 'user.comment', 'hello'); xattr.remove('$$TESTFILE', 'user.comment')"; \
80 $(MAKE) test CFLAGS="-coverage"
81 lcov --capture --directory . --no-external --output-file coverage.info
82 genhtml coverage.info --output-directory out
85 rm -rf $(DOCHTML) $(DOCTREES)
90 .PHONY: doc test fast-test clean dist distcheck coverage