#!/usr/bin/make -f

DOCS=$(shell cd docs && find ./ -name "*.txt" -printf "%p " | sed "s/.txt//g")
docdir=debian/python-pastewebkit/usr/share/doc/python-pastewebkit/docs/

export PYBUILD_NAME=paste
export PYBUILD_DESTDIR_python2=debian/python-pastewebkit/

%:
	dh $@ --with python2 --buildsystem pybuild

override_dh_installdocs:
	dh_installdocs
	mkdir -pv $(docdir)
	set -e ; for NAME in $(DOCS); do \
		rst2html --cloak-email-addresses --no-toc-backlinks "docs/$$NAME.txt" \
			> "$(docdir)$$NAME.html"; \
	done
