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

PYVERS = $(shell pyversions -vr)
PYVER = $(shell pyversions -vd)
PY3VERS = $(shell py3versions -vr)
PY3VER = $(shell py3versions -vd)

%:
	dh $@ --buildsystem=python_distutils --with=python2,python3

override_dh_auto_install: ${PYVERS:%=python-install%} ${PY3VERS:%=python-install%}
python-install%:
	python$* setup.py install --install-layout=deb --root=$(CURDIR)/debian/tmp

override_dh_clean:
	rm -rf *.egg-info
	rm -rf build
	dh_clean

override_dh_auto_test: ${PYVERS:%=python-test%} ${PY3VERS:%=python-test%}

python-test%:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	python$* /usr/bin/nosetests --with-doctest -s -v --exclude test_nested_exception_dispatch joblib;
else
	: # Skip unittests due to nocheck
endif


override_dh_installchangelogs:
	dh_installchangelogs CHANGES.rst
