#!/usr/bin/make -f

export PYBUILD_NAME=docxtpl

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

override_dh_auto_test: debian/test.jpg debian/test.png
	cp debian/test.png tests/templates/dummy_pic_for_header.png
	cp debian/test.png tests/templates/python_logo.png
	cp debian/test.png tests/templates/django.png
	cp debian/test.png tests/templates/python.png
	cp debian/test.png tests/templates/zope.png
	cp debian/test.png tests/templates/bottle.png
	cp debian/test.png tests/templates/tornado.png
	cp debian/test.png tests/templates/pyramid.png
	cp debian/test.jpg tests/templates/python_jpeg.jpg
	cd tests && PYTHONPATH=$$(find ../.pybuild -name build 2>/dev/null | xargs echo | tr ' ' :) python3 runtests.py

override_dh_auto_clean:
	dh_auto_clean
	rm -rf docxtpl.egg-info tests/output

debian/test.jpg: debian/test.png
	pngtopnm $< | pnmtojpeg > $@

debian/test.png:
	qrencode --output $@ TEST
