#!/usr/bin/make -f

PYTHON3S:=$(shell py3versions -vr)

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

override_dh_auto_install:
	set -e ; for pyvers in $(PYTHON3S); do \
		python$$pyvers setup.py install --install-layout=deb \
			--root $(CURDIR)/debian/python3-qrcode; \
	done
	rm -f $(CURDIR)/debian/python*-oslo.utils/usr/lib/python*/dist-packages/*.pth
	mv $(CURDIR)/debian/python3-qrcode/usr/bin/qr $(CURDIR)/debian/python3-qrcode/usr/bin/python3-qr
	mv $(CURDIR)/debian/python3-qrcode/usr/share/man/man1/qr.1 $(CURDIR)/debian/python3-qrcode/usr/share/man/man1/python3-qr.1

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

override_dh_installchangelogs:
	dh_installchangelogs CHANGES.rst

override_dh_auto_test:
	# FIXME: some tests fail with `pkg_resources.DistributionNotFound: The 'qrcode' distribution was not found and is required by the application`
	-dh_auto_test
