#!/usr/bin/make -f

#DH_VERBOSE = 1
include /usr/share/dpkg/default.mk

export PYBUILD_NAME=kineticstools

INSTDIR = $(CURDIR)/debian/$(DEB_SOURCE)
BINDIR = $(INSTDIR)/usr/bin
MANDIR = $(INSTDIR)/usr/share/man/

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

override_dh_auto_test:
# Ignore error code here since there looks to be
# a spurious DistributionNotFound error for some reason
	-PYBUILD_SYSTEM=custom \
	PYBUILD_TEST_ARGS="$(MAKE) unit-tests" dh_auto_test

override_dh_auto_install:
	dh_auto_install
	mkdir -p $(BINDIR)
	mv debian/python-kineticstools/usr/bin/* $(BINDIR)
	mkdir -p $(MANDIR)/man1
	rst2man doc/manual.rst > $(MANDIR)/man1/ipdSummary.1
