2 TESTDIR = $(CURDIR)/test
3 TESTLIB = $(TESTDIR)/lib
4 BUILDDIR = $(CURDIR)/build
5 DISTDIR = $(CURDIR)/dist
7 # stupid distutils, it's broken in so many ways
8 SUBBUILDDIR = $(shell python -c 'import distutils.util, sys; \
9 print "lib.%s-%s" % (distutils.util.get_platform(), \
11 PYTHON25 := $(shell python -c 'import sys; v = sys.version_info; \
12 print (1 if v[0] <= 2 and v[1] <= 5 else 0)')
15 BUILDDIR := $(BUILDDIR)/$(SUBBUILDDIR)
17 BUILDDIR := $(BUILDDIR)/lib
20 PYPATH = $(BUILDDIR):$(TESTLIB):$(PYTHONPATH)
21 COVERAGE = $(or $(shell which coverage), $(shell which python-coverage), \
32 for i in `find "$(TESTDIR)" -iname '*.py' -perm -u+x -type f`; do \
34 TESTLIBPATH="$(TESTLIB)" PYTHONPATH="$(PYPATH)" $$i -v || retval=$$?; \
39 for i in `find "$(TESTDIR)" -perm -u+x -type f`; do \
41 TESTLIBPATH="$(TESTLIB)" PYTHONPATH="$(PYPATH)" $(COVERAGE) -x $$i -v; \
44 $(COVERAGE) -r -m `find "$(BUILDDIR)" -name \\*.py -type f`
49 rm -f `find -name \*.pyc` .coverage *.pcap
55 find . -path ./.hg\* -prune -o -path ./build -prune -o \
56 -name \*.pyc -prune -o -name \*.swp -prune -o \
57 -name MANIFEST -prune -o -type f -print | \
58 sed 's#^\./##' | sort > MANIFEST
63 .PHONY: all clean distclean dist test coverage install MANIFEST