#! /usr/bin/make -f

export DH_VERBOSE=1

export PYBUILD_NAME=duecredit
export PYBUILD_AFTER_INSTALL_python3=rm -rf {destdir}/usr/bin/

PYVER = $(shell py3versions -sv)

export LC_ALL=C.UTF-8
# there is still some race condition somewhere so injection test on a fast system
# manages to fail... to slow things down -- turning on debug
export DUECREDIT_LOGLEVEL=DEBUG

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

override_dh_clean:
	dh_clean
	-rm duecredit/version.py  # autogenerated

# tests must be run from topdir
# else a citeproc error is triggered from build_dir
override_dh_auto_test:
	for py in $(PYVER); do \
	  PYTHONPATH=`pybuild -p $$py --print {build_dir}` \
	  python$$py -mpytest -k "not (test_injector_del or test_import_doi)"; \
	done
