#!/usr/bin/make -f

#export DH_VERBOSE=1
#export PYBUILD_VERBOSE=1
export PYBUILD_NAME=tox

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

# The tests are not runnable during package build because many invoke the tox
# command line.  It's too much work to make the test suite run partially here
# because upstream always changes the mix.
override_dh_auto_test:

override_dh_auto_build: export http_proxy=127.0.0.1:9
override_dh_auto_build: export https_proxy=127.0.0.1:9
override_dh_auto_build:
	dh_auto_build
	# build HTML docs and manpages with Sphinx
	PATH=debian/faketowncrier:$$PATH \
	PYTHONPATH=src:$$PYTHONPATH \
	  python3 -m sphinx -N -bhtml docs/ build/html
	PATH=debian/faketowncrier:$$PATH \
	PYTHONPATH=src:$$PYTHONPATH \
	  python3 -m sphinx -N -bman docs/ build/man
	# dh_installdocs skips this if empty, so add a newline...
	echo > build/html/_sources/_draft.rst.txt

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build
	rm -rf *.egg-info
	rm -rf .tox
