#!/usr/bin/make -f

#export DH_VERBOSE=1

-include /usr/share/python/python.mk

PYVERS := $(shell pyversions -sv)

export CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
export CFLAGS   := $(shell dpkg-buildflags --get CFLAGS)
export LDFLAGS  := $(shell dpkg-buildflags --get LDFLAGS) -Wl,--as-needed

%:
	dh $@ --with python2 --parallel

override_dh_auto_test:
	-for PY in $(PYVERS); do \
	  py_path="$(CURDIR)/build/lib.`python$${PY} -c 'from distutils import util; print util.get_platform();'`-$$PY/" ; \
	  (cd tests; PYTHONPATH=$$py_path python$$PY unit2 discover); \
	done
