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

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
PYDEF=$(shell pyversions -d)
PYVERS=$(shell pyversions -r)

%:
	dh $@ --with python2

override_dh_auto_build:
	# Add here commands to compile the package.
	for python in $(PYVERS); do \
		python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \
		USE_MELD3_EXTENSION_MODULES=true \
		$$python setup.py build; \
	done
	touch $@
	dh_auto_build

override_dh_clean:
	for python in $(PYVERS); do \
		python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \
		USE_MELD3_EXTENSION_MODULES=true \
		$$python setup.py clean; \
	done
	rm -rf build/
	dh_clean 

override_dh_installdirs:
	dh_installdirs
	# Add here commands to install the package into debian/tmp
	set -e; \
	for python in $(PYVERS); do \
		pydir=$$python \
		python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \
		USE_MELD3_EXTENSION_MODULES=true \
		$$python setup.py install --no-compile --root=debian/tmp --install-layout=deb; \
	done

override_dh_installchangelogs:
	dh_installchangelogs CHANGES.txt

override_dh_install:
	dh_install --sourcedir=debian/tmp

