#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

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

# instruct setuptools_scm to not fetch the version from git
export SETUPTOOLS_SCM_PRETEND_VERSION = $(DEB_VERSION_UPSTREAM)

%:
	dh $@ --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:

ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
execute_after_dh_auto_build: export http_proxy=127.0.0.1:9
execute_after_dh_auto_build: export https_proxy=127.0.0.1:9
execute_after_dh_auto_build:
	# build HTML docs and manpages with Sphinx
	PYTHONPATH=src:$$PYTHONPATH \
	  python3 -m sphinx -N -bhtml docs/ build/html
	# dh_installdocs skips this if empty, so add a newline...
	echo > build/html/_sources/_draft.rst.txt
endif
