#!/usr/bin/make -f

%:
	dh "$@" --with python3

# needs manual commands for Python 3, see Debian #597105
override_dh_auto_clean:
	set -ex; for python in $(shell py3versions -r); do \
	    $$python setup.py clean || true; \
	done
	rm -rf build

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

override_dh_auto_install:
	set -ex; for python in $(shell py3versions -r); do \
	    $$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
	done

override_dh_auto_test:
ifeq (, $(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	set -ex; for python in $(shell py3versions -r); do \
            echo "======== Running tests with $$python ==========="; \
	    $$python ./setup.py test; \
	done
endif

override_dh_compress:
	dh_compress -X.py
