#!/usr/bin/make -f

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

override_dh_install:
	dh_install
	install -D -m 755 debian/dh_pyppd $(CURDIR)/debian/pyppd/usr/bin/dh_pyppd
	install -D -m 644 debian/dh_pyppd.pm $(CURDIR)/debian/pyppd/usr/share/perl5/Debian/Debhelper/Sequence/pyppd.pm

# build/install needs manual commands, see Debian #597105
override_dh_auto_build:
	set -ex; for python in $(shell py3versions -r); do \
		$$python ./setup.py build ; \
	done
	pod2man -c Debhelper -r '' debian/dh_pyppd > debian/dh_pyppd.1

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3

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

override_dh_auto_clean:
	rm -f debian/dh_pyppd.1
	rm -rf build
