#! /usr/bin/make -f

# export DH_VERBOSE=1
# export DH_OPTIONS=-v
# export PYBUILD_VERBOSE=1
# export NOSE_VERBOSE=2

export PYBUILD_NAME=sparqlwrapper

# copy the tests to the build dir to be able to pass nose
export PYBUILD_AFTER_BUILD=cp -r test {build_dir}
export PYBUILD_BEFORE_INSTALL=rm -fr {build_dir}/test

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

override_dh_auto_test:
	PYBUILD_DISABLE_python3=test \
	PYBUILD_SYSTEM=custom \
	PYBUILD_TEST_ARGS="cd {build_dir} && nosetests" \
	dh_auto_test --buildsystem=pybuild

	PYBUILD_BEFORE_TEST='cp -r {dir}/test {build_dir}'
	PYBUILD_BEFORE_TEST_python3='cp -r {dir}/test {build_dir}; 2to3 -w {build_dir}/test' \
	PYBUILD_AFTER_TEST='rm -rf {build_dir}/test' \
	PYBUILD_DISABLE_python2=test \
	PYBUILD_SYSTEM=custom \
	PYBUILD_TEST_ARGS="cd {build_dir} && nosetests3" \
	dh_auto_test --buildsystem=pybuild
