#!/usr/bin/make -f

LAST_CHANGE = $(shell dpkg-parsechangelog -S Date)
BUILD_DATE  = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
SPHINXOPTS := -D today=\"$(BUILD_DATE)\"

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

override_dh_auto_test:
ifeq (, $(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	# disable appengine and django tests, dependencies missing
	rm -f tests/ext_appengine/__init__.py tests/ext_django/__init__.py
	dh_auto_test
	touch tests/ext_appengine/__init__.py tests/ext_django/__init__.py
endif

override_dh_auto_build:
	dh_auto_build
	rm -f docs/_templates/layout.html
	cd docs && make html SPHINXOPTS="$(SPHINXOPTS)"
