#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PYTHONS:=$(shell pyversions -vr)

%:
	dh $@  --with python2

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	set -e && set -x && \
	for i in $(PYTHONS) ; do \
		echo "===> Testing for python$$i" ; \
		rm -rf .testrepository ; \
		testr init ; \
		TEMP_REZ=`mktemp -t` && \
		PYTHON=python$$i PYTHONPATH=$(CURDIR) testr run --subunit | tee $$TEMP_REZ | subunit2pyunit ; \
		cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
		rm -f $$TEMP_REZ ; \
		testr slowest ; \
	done
endif


get-orig-source:
	uscan --verbose --force-download --rename --repack --download-current-version --destdir=../build-area
