#!/usr/bin/make -f

%:
	dh $@ --buildsystem=python_distutils --with=python3,systemd

override_dh_auto_build:
	# 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
	# 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
	./setup.py build
	#dh_auto_build

override_dh_auto_clean:
	./setup.py clean
	#dh_clean --with=python3
	cd $(CURDIR)/po; make clean

override_dh_auto_install:
	find * -name __pycache__ | xargs rm -rf
	./setup.py install --force \
		--root=debian/tmp --no-compile -O0 --install-layout=deb

override_dh_systemd_enable:
	dh_systemd_enable --name=ubuntu-recovery-tasks
