#!/usr/bin/make -f
#DH_VERBOSE = 1

export PYBUILD_NAME = tap

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

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. http_proxy='127.0.0.1:9' python3 -m sphinx -N -bhtml docs/ build/html # HTML generator
	PYTHONPATH=. http_proxy='127.0.0.1:9' python3 -m sphinx -N -bman docs/ build/man # HTML generator

override_dh_install:
	install -d $(CURDIR)/debian/tappy/usr/bin
	mv $(CURDIR)/debian/python3-tap/usr/bin/tappy $(CURDIR)/debian/tappy/usr/bin/
	dh_install -O--buildsystem=pybuild
	# Avoid namespace-grab, and file conflict with node-tap
	rm -f debian/*/usr/bin/tap

execute_after_dh_auto_test:
	set -e; for python in $$(py3versions -s); do \
		PYTHONPATH="$(CURDIR)" "$$python" -m unittest discover -v -s ./tests; \
	done

override_dh_sphinxdoc:
	dh_sphinxdoc -p python-tap-doc

override_dh_auto_clean:
	dh_auto_clean
	make -C docs clean
