#!/usr/bin/make -f

#DH_VERBOSE=1

PYTHON3=$(shell py3versions -vr)

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

override_dh_auto_install:
	dh_auto_install
	rm -r debian/tmp/usr/lib/*/dist-packages/aptdaemon/__pycache__/
	rm -r debian/tmp/usr/lib/*/dist-packages/aptdaemon/worker/__pycache__/

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build *.egg-info po/aptdaemon.pot

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
test-python%:
	# wait until previous xvfb-run has finished
	while [ -e /tmp/.X99-lock ]; do sleep 1; done
	xvfb-run nosetests3 --process-restartworker --process-timeout=60 --exclude=test_cdrom

override_dh_auto_test: $(PYTHON3:%=test-python%)
endif
