#! /usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

PYTHON3_VERSIONS = $(shell py3versions -r)
py3sdo = set -e; $(foreach py, $(PYTHON3_VERSIONS), $(py) $(1);)

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
	$(call py3sdo, setup.py build)

override_dh_auto_install:
	# whichever called last, will result in shebang update
	# in this case, the scripts will end up with python3 shebang
	# reverse the order if you want to continue using python2 shebang
	dh_auto_install
	$(call py3sdo, setup.py install --root=$(CURDIR)/debian/$(DEB_SOURCE) --install-layout=deb)

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build
	rm -rf *.egg-info
