#!/usr/bin/make -f
# -*- makefile -*-

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

include /usr/share/dpkg/pkg-info.mk
export PYBUILD_NAME=$(DEB_SOURCE)

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

override_dh_bash-completion:
	dh_bash-completion
	cp zsh_completion_doit debian/python3-doit/usr/share/zsh/vendor-completions/_doit

override_dh_auto_clean:
	dh_auto_clean
	rm -rf doc/_build
	rm -f debian/doit.1
	rm -f tests/data/stop
	rm -f tests/data/dependency*
	rm -f tests/data/target
	rm -f tests/data/w*.txt

override_dh_auto_install:
	dh_auto_install
	# Generate manpages, stripping out the non-reproducible 'lib @ <dir>' line.
	help2man debian/doit.sh | grep -v 'lib @' > debian/doit.1
	# build the html pages for the -doc package
	set -ex; \
		export PYTHONPATH=$(CURDIR); \
		cd doc; \
		make html;

override_dh_auto_test:
	# Disable test on build time. They are executed by autopkgtest

get-orig-source:
	uscan --download-version $(DEB_VERSION_UPSTREAM)
