#!/usr/bin/make -f
# -*- makefile -*-

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

PYVERS:=$(shell pyversions -s)

%:
	dh  $@ --with=python2

override_dh_auto_install:
	dh_auto_install
	# it's just 'unit2' but it's targetted to windows systems
	rm $(CURDIR)/debian/python-unittest2/usr/bin/unit2.py

override_dh_auto_test:
	for python in $(PYVERS) ; do \
	    # retrive the lib path \
	    LIB=$$($$python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_purelib") ; \
	    # retrieve the script path \
	    SCRIPT=$$($$python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_scripts") ; \
	    # call the unit2 test script discovering the current LIB dir \
	    PYTHONPATH=$$LIB $$python $$SCRIPT/unit2 discover -s $$LIB ; \
	done
