#!/usr/bin/make -f

pkg = silkaj
manpage = debian/silkaj.1
executable = debian/$(pkg)/usr/bin/silkaj

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

# generate manpage based on --help option of script itself
override_dh_auto_install: \
 _PYTHONPATH = debian/$(pkg)/usr/lib/$(shell py3versions -d)/dist-packages
override_dh_auto_install:
	dh_auto_install
	PYTHONPATH=$(_PYTHONPATH) help2man \
		--name="command-line client for Duniter" \
		--no-info \
		--output=$(manpage) \
		$(executable) \
		|| { PYTHONPATH=$(_PYTHONPATH) $(executable) --help; false; }
	find debian/$(pkg)/usr/lib -name '*.pyc' -delete
	find debian/$(pkg)/usr/lib -type d -empty -delete
