#!/usr/bin/make -f

#optipng makes png's indexed which GRUB2 doesn't understand
export NO_PNG_PKG_MANGLE=1

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

check:
	# Sanity-check before upload.
	find -name debian -prune -o -name \*.py -print | xargs py3compile
	find -type f \( -name \*.pyc -o -name \*.pyo \) -print0 | xargs -0r rm -f
	find -type d -name __pycache__ -print0 | xargs -0r rm -rf

	# Check the syntax of any shell scripts.
	set -e; for x in $$(find -type f -print0 | xargs -0 file -i | grep "text/x-shellscript" | cut -d':' -f1); do \
			sh -n $$x; \
	done
	# Check the syntax of any Python scripts.
	./tests/run-pyflakes

override_dh_clean: check
	dh_clean
	cd $(CURDIR)/po; make clean
	cd $(CURDIR)/secure_boot; make clean
