#!/usr/bin/make -f

%:
	dh $@ --with python2,sphinxdoc

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
	PYTHONPATH=. sphinx-build -b html -d docs/build/.doctrees -N docs/source docs/build/html
	dh_auto_build

override_dh_installchangelogs:
	dh_installchangelogs CHANGELOG

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

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