#!/usr/bin/make -f

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

export PYBUILD_NAME=django-sitetree

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

override_dh_auto_build:
	set -e; \
	for loc in sitetree/locale/*; do \
		python setup.py compile_catalog --directory sitetree/locale/ --locale $$(basename $$loc) --domain django; \
	done
	dh_auto_build
	PYTHONPATH=. sphinx-build -b html -d docs/build/.doctrees -N docs/source docs/build/html

override_dh_installchangelogs:
	dh_installchangelogs CHANGELOG

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	set -e; \
	for python in $(shell pyversions -r) $(shell py3versions -r); do \
		$$python sitetree/runtests.py; \
	done
endif

override_dh_clean:
	rm -rf docs/build/html
	rm -rf docs/build/.doctrees
	dh_clean
