#!/usr/bin/make -f

# DH_VERBOSE := 1
include /usr/share/dpkg/default.mk

TESTDIR        := debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/tests

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

override_dh_fixperms:
	dh_fixperms
	find debian -name checkLibraries.R -exec chmod +x \{\} \;
	find debian -name runGeneral.R     -exec chmod +x \{\} \;

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd mapdamage && \
	PATH=$(PATH):$(CURDIR)/bin \
	PYTHONPATH=$(shell pybuild --print build_dir --interpreter python3) \
	python3 mp_test.py
endif

override_dh_python3:
	dh_python3 --no-ext-rename

override_dh_auto_clean:
	dh_auto_clean
	rm -f mapdamage/_version.py
