#!/usr/bin/make -f

export PYBUILD_NAME=		feature_check
export PYBUILD_TEST_PYTEST=	1
export PYBUILD_DISABLE=		test/pypy

D=	${CURDIR}/debian
DTMP=	$D/tmp
PY=	${CURDIR}/python

%:
	dh "$@" --with python2,python3,pypy

override_dh_auto_build:
	dh_auto_build
	dh_auto_build -D '${PY}' --buildsystem pybuild

override_dh_auto_install:
	dh_auto_install -- \
		PREFIX=/usr \
		MANDIR=/usr/share/man/man \
		INSTALL_SCRIPT='install -m 755' \
		INSTALL_DATA='install -m 644'
	dh_auto_install -D '${PY}' --buildsystem pybuild

ifeq (,$(filter nocheck,${DEB_BUILD_OPTIONS}))
override_dh_auto_test:
	dh_auto_test
	env PYTHONPATH='${PY}' debian/tests/tap-python.sh
	dh_auto_test -D '${PY}' --buildsystem pybuild -- --test-args '${PY}/unit_tests'
endif

override_dh_installchangelogs:
	dh_installchangelogs -X CHANGES.md
	install -m 644 -- CHANGES.md '$D/feature-check/usr/share/doc/feature-check/NEWS'

override_dh_auto_clean:
	dh_auto_clean
	dh_auto_clean -D '${PY}' --buildsystem pybuild
	rm -rf -- test-python '${PY}/feature_check.egg-info' '${PY}/.pytest_cache'

override_dh_missing:
	dh_missing --fail-missing
