#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

python2 := $(shell pyversions --requested --version debian/control)
python3 := $(shell py3versions --requested --version debian/control)

%:
	dh $@ --with python2,python3,autoreconf

override_dh_auto_configure:
	set -e && for pyver in $(python2) $(python3); do \
	  dh_auto_configure \
	    --builddirectory=build-python$$pyver \
	    -- \
	     PYTHON=/usr/bin/python$$pyver \
	    --disable-silent-rules \
	    --disable-integration-tests \
	    ; \
	done

override_dh_auto_build:
	dh_auto_install --builddirectory=build-python$(python3)
	dh_auto_install --builddirectory=build-python$(python2)

override_dh_auto_test:
	dh_auto_test --builddirectory=build-python$(python3)

override_dh_auto_install:
	dh_auto_install --builddirectory=build-python$(python3) -- install
	dh_auto_install --builddirectory=build-python$(python2) -- -C python install

override_dh_install:
	dh_install --fail-missing -X.la -X.pyo -X.pyc