#!/usr/bin/make -f

%:
	dh $@ --with python2 --with sphinxdoc

PYVERS:=$(shell pyversions -vr)

override_dh_auto_build:
	dh_auto_build
	mkdir docs/build && python setup.py build_sphinx

override_dh_auto_clean:
	dh_auto_clean
	rm -rf docs/build

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

override_dh_installdocs:
	dh_installdocs --link-doc=python-whoosh

override_dh_fixperms:
	dh_fixperms
	chmod a-x debian/python-whoosh/usr/share/pyshared/*.egg-info/*
	find debian/python-whoosh -name PKG-INFO -exec chmod -x {} \;

override_dh_compress:
	dh_compress -Xdoc/python-whoosh/html
