#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

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

BUILD_DATE=$(shell LC_ALL=C date -u "+%B %d, %Y" -d "@$(SOURCE_DATE_EPOCH)")

export PYBUILD_NAME=amqp
export PYBUILD_BEFORE_TEST=cp -r {dir}/t {build_dir} ; rm -rf {build_dir}/t/integration
export PYBUILD_AFTER_TEST=rm -rf {build_dir}/t

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

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=. python3 -m sphinx -D today="$(BUILD_DATE)" -b html -N docs/ $(CURDIR)/debian/python-amqp-doc/usr/share/doc/python-amqp-doc/html
	dh_sphinxdoc
endif

override_dh_clean:
	rm -rf docs/.build
	dh_clean

override_dh_installchangelogs:
	dh_installchangelogs docs/changelog.rst
