#!/usr/bin/make -f
export DH_VERBOSE=1

build: build-stamp

build-stamp:
	dh_testdir
	set -ex; for python in $(shell pyversions -r -i) ; do \
		$$python -c 'import sys; print sys.version' >/dev/null 2>&1 \
		&& \
		$$python /usr/bin/nosetests -w . test \
			-m '(?:^|[\b_\./-])[Tt]est(?!_contact)(?!_dbus)' \
			-e test_int_to_uint32_to_int_conversion \
			-e test_populate_db_from_networks_py_real \
		; \
	done
	python setup.py build
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	rm -rf build
	-find . -name '*.py[co]' | xargs rm -f
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	python setup.py install \
		--install-layout=deb \
		--skip-build \
		--root $(CURDIR)/debian/tmp
	-find $(CURDIR)/debian/tmp -name '*.py[co]' | xargs rm -f
	dh_install
	dh_installman
	DH_PYCENTRAL=nomove dh_pycentral

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs CHANGELOG
	dh_installdocs README
	dh_compress -X.py
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
