#!/usr/bin/make -f
# -*- makefile -*-
#
DH_VERBOSE=1

# These commands build the list of supported Python 3 versions
# The last version should be just “python3” so that the scripts
# get a correct shebang.
# Use just “PYTHON3 := $(shell py3versions -r)” if your package
# doesn’t contain scripts
PY3REQUESTED := $(shell py3versions -r)
PY3DEFAULT := $(shell py3versions -d)
PYTHON3 := $(filter-out $(PY3DEFAULT),$(PY3REQUESTED)) python3

%:
	# Adding the required helpers
	dh $@ --with python2,python3

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build/

override_dh_auto_build:
	# Build for each Python 3 version
	set -ex; for python in $(PYTHON3); do \
		$$python setup.py build; \
	done
	dh_auto_build

override_dh_auto_install:
	# The same for install; note the --install-layout=deb option
	set -ex; for python in $(PYTHON3); do \
		$$python setup.py install --install-layout=deb --root=debian/tmp; \
	done
	dh_auto_install

#export PYBUILD_NAME=lhafile
#
#%:
#	dh $@ --with python2,python3 --buildsystem=pybuild
