3 TESTDIR = $(CURDIR)/test
4 TESTLIB = $(TESTDIR)/lib
5 BUILDDIR = $(CURDIR)/build/lib
6 DISTDIR = $(CURDIR)/dist
8 PYPATH = $(BUILDDIR):$(TESTLIB):$(PYTHONPATH)
9 COVERAGE = $(or $(shell which coverage), $(shell which python-coverage), \
13 PYTHONPATH="$(PYTHONPATH):$(SRCDIR)" $(PYTHON) ./setup.py build
16 PYTHONPATH="$(PYTHONPATH):$(SRCDIR)" $(PYTHON) ./setup.py install
20 for i in `find "$(TESTDIR)" -iname '*.py' -perm -u+x -type f`; do \
22 PYTHONPATH="$(PYPATH)" $(PYTHON) $$i -v || retval=$$?; \
27 echo Run $(make) $@ file=test/some/path
31 PYTHONPATH="$(PYPATH)" $(PYTHON) $(file) $(case)
35 $(MAKE) test-one file=test/resources/linux/application.py case=$(case)
37 $(MAKE) test-one file=test/resources/linux/node.py case=$(case)
41 for i in `find "$(TESTDIR)" -perm -u+x -type f`; do \
43 PYTHONPATH="$(PYPATH)" $(COVERAGE) -x $$i -v; \
46 $(COVERAGE) -r -m `find "$(BUILDDIR)" -name \\*.py -type f`
50 rm -f $$(find . -name '*.pyc') .coverage *.pcap
57 find . -path ./.hg\* -prune -o -path ./build -prune -o \
58 -name \*.pyc -prune -o -name \*.swp -prune -o \
59 -name MANIFEST -prune -o -type f -print | \
60 sed 's#^\./##' | sort > MANIFEST
65 .PHONY: all clean distclean dist test coverage install MANIFEST
67 ########## for uploading onto pypi
68 # this assumes you have an entry 'pypi' in your .pypirc
69 # see pypi documentation on how to create .pypirc
71 ifneq "$(LOCAL_ID)" "$(filter $(LOCAL_ID),parmen)"
78 PYPI_TARBALL_HOST=$(BUILD_ID)@build.onelab.eu
79 PYPI_TARBALL_TOPDIR=/build/nepi
81 VERSION=$(shell cat VERSION)
82 VERSIONTAG=nepi-$(VERSION)-pypi
83 VERSIONTAR=nepi-$(VERSION).tar.gz
84 ALREADY_SET=$(shell git tag | grep '^$(VERSIONTAG)$$')
86 # run this only once the sources are in on the right tag
88 @echo "Have you committed all changes (type Ctrl-c if not) ? " ; read _
89 @if [ -n "$(ALREADY_SET)" ] ; then echo "tag $(VERSIONTAG) already set"; false; fi
90 @echo "You are about to release $(VERSION) - OK (Ctrl-c if not) ? " ; read _
92 #./setup.py sdist upload -r pypi
94 twine upload dist/* -r pypi
95 @if [ ssh $(PYPI_TARBALL_HOST) ls $(PYPI_TARBALL_TOPDIR)/$(VERSIONTAR) ] ;\
96 then echo "$(VERSIONTAR) already present on $(PYPI_TARBALL_HOST) - ignored" ;\
97 else rsync -av dist/$(VERSIONTAR) $(PYPI_TARBALL_HOST):$(PYPI_TARBALL_TOPDIR)/ ;\
101 # it can be convenient to define a test entry, say testpypi
102 # that points at the testpypi public site
103 # in this case we do not want to upload anything on the build box though
106 #./setup.py sdist upload -r testpypi
108 twine upload dist/* -r testpypi
110 #################### convenience, for debugging only
111 # make +foo : prints the value of $(foo)
112 # make ++foo : idem but verbose, i.e. foo=$(foo)
113 ++%: varname=$(subst +,,$@)
115 @echo "$(varname)=$($(varname))"
116 +%: varname=$(subst +,,$@)
118 @echo "$($(varname))"