#!/usr/bin/make -f

VERSION = $(shell dpkg-parsechangelog --show-field Version | cut -f1 -d-)

export PYBUILD_NAME=pygtail
%:
	dh $@ --with python2,python3 --buildsystem=pybuild

override_dh_auto_install:
	dh_auto_install
	# Remove the script from the python 2 package
	rm debian/python-pygtail/usr/bin/pygtail
	# Move the python 3 script to the pygtail package
	mkdir -p debian/pygtail/usr/bin
	mv debian/python3-pygtail/usr/bin/pygtail debian/pygtail/usr/bin/

override_dh_installman:
	PYTHONPATH="." help2man --no-info --version-string="${VERSION}" \
		--name="read log file lines that have not been read" \
		--output=debian/pygtail.1 \
		./debian/pygtail/usr/bin/pygtail
	dh_installman
