#!/usr/bin/make -f
#export DH_VERBOSE=1
export PYBUILD_NAME=citeproc

VERSION := $(shell dpkg-parsechangelog -Sversion | cut -d- -f1)
DEBDATE := $(shell dpkg-parsechangelog -Sdate | date -u +"%F" -f -)

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

override_dh_auto_test:
	PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="{interpreter} -m pytest -v -x" dh_auto_test

override_dh_installdocs:
	dh_installdocs -A README.rst

override_dh_installexamples:
	dh_installexamples -A examples/*
	sed -i 's/usr\/bin\/env\ python/usr\/bin\/env\ python3/' debian/python3-citeproc/usr/share/doc/python3-citeproc/examples/*py

override_dh_installman:
	txt2man -s 1 -v "python3-citeproc" -t "csl_unsorted" -r "$(VERSION)" -d "$(DEBDATE)" debian/csl_unsorted.txt > .pybuild/csl_unsorted.1
	dh_installman -ppython3-citeproc .pybuild/csl_unsorted.1
