#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1
# exclude VCS paths if needed.
#DH_ALWAYS_EXCLUDE=CVS:.svn:.git

# see FEATURE AREAS in dpkg-buildflags(1))
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1))
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Customize this by adding more override scripts (see dh(1))
%:
		dh $@ --with "python2,python3"


# special work around for python3 (#538978 and #597105 bugs)
PY3REQUESTED := $(shell py3versions -r)
PY3DEFAULT := $(shell py3versions -d)
PYTHON3 := $(filter-out $(PY3DEFAULT),$(PY3REQUESTED)) python3

override_dh_auto_clean:
	-rm -rf build

override_dh_auto_build:
	set -ex; for python in $(PYTHON3); do \
	    $$python setup.py build; \
	done

override_dh_auto_install:
	set -ex; for python in $(PYTHON3); do \
	    $$python setup.py install \
	        --root={}\
	        --force\
	        --install-layout=deb; \
	done

