#!/usr/bin/make -f

%:
	dh $@ --with python2,sphinxdoc

override_dh_auto_build:
	/bin/echo -e '# On Debian, we use the packaged mock\n'\
	'from __future__ import absolute_import\n'\
	'from mock import *' > tests/mock.py

	dh_auto_build

	rm -rf doc/_build/html
	PYTHONPATH=. sphinx-build -N -bhtml doc/ doc/_build/html

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	set -e; \
	for python in $(shell pyversions -r); do \
		$$python setup.py test; \
	done
endif

override_dh_compress:
	dh_compress -X.inv -X.txt

override_dh_clean:
	dh_clean
	rm -rf *.egg-info
	rm -rf doc/_build/html
	rm -f tests/mock.py
