#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

export PYBUILD_NAME=biom-format
export PYBUILD_DESTDIR_python2=debian/python-$(PYBUILD_NAME)
export PYBUILD_DESTDIR_python3=debian/python3-$(PYBUILD_NAME)
export PYBUILD_AFTER_INSTALL_python2=dh_numpy
export PYBUILD_AFTER_INSTALL_python3=dh_numpy3
export PYBUILD_BEFORE_TEST=cp -r {dir}/examples {dir}/tests {build_dir}

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

override_dh_auto_build-arch:
	USE_CYTHON=true dh_auto_build

override_dh_auto_build-indep:
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -b html doc build/html
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -b man doc build/man

override_dh_auto_install:
	dh_auto_install
	# Install command-line scripts in separate tools package.
	dh_install --sourcedir=$(PYBUILD_DESTDIR_python3) \
		--package=$(PYBUILD_NAME)-tools usr/bin
	rm -rf $(PYBUILD_DESTDIR_python2)/usr/bin
	rm -rf $(PYBUILD_DESTDIR_python3)/usr/bin

override_dh_installdocs-indep:
	dh_installdocs --indep
	dh_sphinxdoc --indep
