#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export DH_VERBOSE := 1

# if argparse-manpage didn't generate the manpages, use help2man
export PYBUILD_AFTER_INSTALL_python3.5 := \
	if [ ! -f {destdir}/usr/share/man/man1/igwn-accounting-report.1 ]; then \
	echo "Automatically generating man pages with help2man" && \
	mkdir -p {destdir}/usr/share/man/man1 && \
	echo "    igwn-accounting-report..." && \
	env PYTHONPATH={destdir}{install_dir} help2man \
		--source $(DEB_SOURCE) \
		--version-string $(DEB_VERSION_UPSTREAM) \
		--no-info \
		--no-discard-stderr \
		--name "generate a condor usage report" \
		--output {destdir}/usr/share/man/man1/igwn-accounting-report.1 \
		{destdir}/usr/bin/igwn-accounting-report; \
	fi;

export PYBUILD_OPTION = --test-pytest

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