#!/usr/bin/make -f

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

BINDIR=$(CURDIR)/debian/pbh5tools/usr/bin

export PYBUILD_NAME = pbh5tools

%:
	LC_ALL=C.UTF-8 dh $@ --with python2 --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
	$(MAKE) -C doc html

override_dh_install:
	dh_install
	# We do this here rather than in .install files so that debhelper
	# takes care of the #!/usr/bin/env lines for us
	mkdir -p $(BINDIR)
	mv debian/python-pbh5tools/usr/bin/bash5tools.py $(BINDIR)/bash5tools
	mv debian/python-pbh5tools/usr/bin/cmph5tools.py $(BINDIR)/cmph5tools

override_dh_auto_test:
	PYBUILD_SYSTEM=custom \
	PYBUILD_TEST_ARGS="PATH=$(CURDIR)/build/scripts-2.7:$$PATH $(MAKE) test" \
	  dh_auto_test

override_dh_auto_clean:
	dh_auto_clean
	$(MAKE) clean
