#!/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)))
	dh_auto_test -- --system=custom --test-args \
		"cd {build_dir}; \
		rm -f tests/ext_sqlalchemy.py; \
		{interpreter} tests/runtests.py -v"
endif

override_dh_auto_build:
	pybabel compile -D wtforms -d wtforms/locale
	dh_auto_build
	rm -f docs/_templates/layout.html
	cd docs && make html SPHINXOPTS="$(SPHINXOPTS)"
