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

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


# Get the supported Python versions
PYVERS = $(shell pyversions -r -v)


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


override_dh_install:
	# Install everything excluding the *_d.so debug extensions to python-numexpr
	dh_install -X"*_d.so" "debian/tmp/*" -p python-numexpr

	# Install the debug extensions to python-numexpr-dbg
	dh_install "debian/tmp/usr/lib/python*/*-packages/numexpr/*_d.so" -p python-numexpr-dbg

	# Continue with regular dh_install
	dh_install
	dh_numpy
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	set -e -x;\
	for py in $(PYVERS); do \
		cd $(CURDIR)/build/lib.*-$$py;\
		env PYTHONPATH=. python$$py numexpr/tests/test_numexpr.py;\
		cd $(CURDIR)/build/lib.*-$$py-pydebug;\
		env PYTHONPATH=. python$$py-dbg numexpr/tests/test_numexpr.py;\
	done
endif

.PHONY: dh_auto_install

