2 TESTDIR = $(CURDIR)/test
3 TESTLIB = $(TESTDIR)/lib
4 BUILDDIR = $(CURDIR)/build/lib
5 DISTDIR = $(CURDIR)/dist
7 PYPATH = $(BUILDDIR):$(TESTLIB):$(PYTHONPATH)
8 COVERAGE = $(or $(shell which coverage), $(shell which python-coverage), \
12 PYTHONPATH="$(PYTHONPATH):$(SRCDIR)" ./setup.py build
15 PYTHONPATH="$(PYTHONPATH):$(SRCDIR)" ./setup.py install
19 for i in `find "$(TESTDIR)" -iname '*.py' -perm -u+x -type f`; do \
21 PYTHONPATH="$(PYPATH)" $$i -v || retval=$$?; \
26 echo Run $(make) $@ file=test/some/path
30 PYTHONPATH="$(PYPATH)" $(file) $(case)
34 $(MAKE) test-one file=test/resources/linux/application.py case=$(case)
36 $(MAKE) test-one file=test/resources/linux/node.py case=$(case)
40 for i in `find "$(TESTDIR)" -perm -u+x -type f`; do \
42 PYTHONPATH="$(PYPATH)" $(COVERAGE) -x $$i -v; \
45 $(COVERAGE) -r -m `find "$(BUILDDIR)" -name \\*.py -type f`
49 rm -f $$(find . -name '*.pyc') .coverage *.pcap
56 find . -path ./.hg\* -prune -o -path ./build -prune -o \
57 -name \*.pyc -prune -o -name \*.swp -prune -o \
58 -name MANIFEST -prune -o -type f -print | \
59 sed 's#^\./##' | sort > MANIFEST
64 .PHONY: all clean distclean dist test coverage install MANIFEST
66 ########## for uploading onto pypi
67 # this assumes you have an entry 'pypi' in your .pypirc
68 # see pypi documentation on how to create .pypirc
70 PYPI_TARBALL_HOST=mario@build.onelab.eu
71 PYPI_TARBALL_TOPDIR=/build/nepi
73 VERSION=$(shell cat VERSION)
74 VERSIONTAG=nepi-$(VERSION)-pypi
75 VERSIONTAR=nepi-$(VERSION).tar.gz
76 ALREADY_SET=$(shell git tag | grep '^$(VERSIONTAG)$$')
78 # run this only once the sources are in on the right tag
80 @echo "Have you committed all changes (type Ctrl-c if not) ? " ; read _
81 @if [ -n "$(ALREADY_SET)" ] ; then echo "tag $(VERSIONTAG) already set"; false; fi
82 @echo "You are about to release $(VERSION) - OK (Ctrl-c if not) ? " ; read _
84 #./setup.py sdist upload -r pypi
86 twine upload dist/* -r pypi
87 @if [ ssh $(PYPI_TARBALL_HOST) ls $(PYPI_TARBALL_TOPDIR)/$(VERSIONTAR) ] ;\
88 then echo "$(VERSIONTAR) already present on $(PYPI_TARBALL_HOST) - ignored" ;\
89 else rsync -av dist/$(VERSIONTAR) $(PYPI_TARBALL_HOST):$(PYPI_TARBALL_TOPDIR)/ ;\
93 # it can be convenient to define a test entry, say testpypi
94 # that points at the testpypi public site
95 # in this case we do not want to upload anything on the build box though
98 #./setup.py sdist upload -r testpypi
100 twine upload dist/* -r testpypi