#!/usr/bin/make -f

# uncomment for verbose output
#export DH_VERBOSE=1

XP=xsltproc --nonet --novalid
DB2MAN=http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl

export PYBUILD_NAME=xhtml2pdf

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

override_dh_installman:
	# build the manpage
	$(XP) $(DB2MAN) debian/xhtml2pdf.dbk
	cp xhtml2pdf.1 xhtml2pdf3.1
	dh_installman

override_dh_auto_install:
	dh_auto_install
	# /usr/bin/xhtml2pdf and /usr/bin/pisa are the same thing,
	# let's only install the one, that is documented
	rm debian/python-xhtml2pdf/usr/bin/pisa
	rm debian/python3-xhtml2pdf/usr/bin/pisa
	mv debian/python3-xhtml2pdf/usr/bin/xhtml2pdf debian/python3-xhtml2pdf/usr/bin/xhtml2pdf3

override_dh_clean:
	-rm xhtml2pdf.1  xhtml2pdf3.1
	dh_clean

