#!/usr/bin/make -f

VER ?= $(shell dpkg-parsechangelog -SVersion)

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

override_dh_auto_build:
	dh_auto_build
	# Generate man page
	PYTHONPATH=. help2man -n "tool for easy creation of Aptly multi component publishes" \
			--version-string=$(VER) "python aptly/publisher/__main__.py" \
		| sed -e s,__main__.py,aptly-publisher,g -e s,__MAIN__.PY,APTLY-PUBLISHER,g \
		> debian/aptly-publisher.1

override_dh_install:
	dh_install
	# aptly-publisher is using python3 by default
	rm -rf debian/python-aptly/usr/bin
	mkdir -p debian/aptly-publisher/usr
	mv debian/python3-aptly/usr/bin debian/aptly-publisher/usr/
