#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

export DH_VERBOSE = 1
export PYBUILD_NAME = ananta

export PY3DEFAULT = $(shell py3versions -d)
export PYTHONPATH_BUILD = debian/python3-$(PYBUILD_NAME)/usr/lib/$(PY3DEFAULT)/dist-packages

%:
	dh $@ --buildsystem=pybuild

override_dh_installman:
	PYTHONPATH=$(PYTHONPATH_BUILD) \
		help2man -n "run a command on multiple SSH hosts in parallel" \
		--version-string=$(DEB_VERSION_UPSTREAM) \
		--no-info --no-discard-stderr debian/$(PYBUILD_NAME)/usr/bin/ananta > debian/ananta.1
	dh_installman

override_dh_install:
	dh_install
	mkdir -p debian/ananta/usr
	mv debian/python3-$(PYBUILD_NAME)/usr/bin debian/ananta/usr/

override_dh_fixperms:
	dh_fixperms
	find debian -name '*.py' -exec chmod -x {} +
