#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

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

export DEB_VERSION_UPSTREAM  # used by patched docs/source/conf.py

export LC_ALL=C.UTF-8
export PYBUILD_INSTALL_DIR=/usr/share/alot/

%:
	dh $@ --buildsystem=pybuild

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
execute_after_dh_auto_build:
	rm -rf $(CURDIR)/docs/build
	$(MAKE) -C docs html man SPHINXOPTS="-D today=\"$(BUILD_DATE)\""
endif # nodoc

override_dh_installchangelogs:
	dh_installchangelogs NEWS
