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 ifneq "$(LOCAL_ID)" "$(filter $(LOCAL_ID),parmen)"
77 PYPI_TARBALL_HOST=$(BUILD_ID)@build.onelab.eu
78 PYPI_TARBALL_TOPDIR=/build/nepi
80 VERSION=$(shell cat VERSION)
81 VERSIONTAG=nepi-$(VERSION)-pypi
82 VERSIONTAR=nepi-$(VERSION).tar.gz
83 ALREADY_SET=$(shell git tag | grep '^$(VERSIONTAG)$$')
85 # run this only once the sources are in on the right tag
87 @echo "Have you committed all changes (type Ctrl-c if not) ? " ; read _
88 @if [ -n "$(ALREADY_SET)" ] ; then echo "tag $(VERSIONTAG) already set"; false; fi
89 @echo "You are about to release $(VERSION) - OK (Ctrl-c if not) ? " ; read _
91 #./setup.py sdist upload -r pypi
93 twine upload dist/* -r pypi
94 @if [ ssh $(PYPI_TARBALL_HOST) ls $(PYPI_TARBALL_TOPDIR)/$(VERSIONTAR) ] ;\
95 then echo "$(VERSIONTAR) already present on $(PYPI_TARBALL_HOST) - ignored" ;\
96 else rsync -av dist/$(VERSIONTAR) $(PYPI_TARBALL_HOST):$(PYPI_TARBALL_TOPDIR)/ ;\
100 # it can be convenient to define a test entry, say testpypi
101 # that points at the testpypi public site
102 # in this case we do not want to upload anything on the build box though
105 #./setup.py sdist upload -r testpypi
107 twine upload dist/* -r testpypi
109 #################### convenience, for debugging only
110 # make +foo : prints the value of $(foo)
111 # make ++foo : idem but verbose, i.e. foo=$(foo)
112 ++%: varname=$(subst +,,$@)
114 @echo "$(varname)=$($(varname))"
115 +%: varname=$(subst +,,$@)
117 @echo "$($(varname))"