#!/usr/bin/make -f

#export DH_VERBOSE=1
export PYBUILD_NAME=nose2

export PKG_VERSION=$(shell dpkg-parsechangelog --show-field version)
export SOURCE_DATE_EPOCH=$(shell dpkg-parsechangelog -S Timestamp)


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

override_dh_sphinxdoc:
	sphinx-build -b html -d debian/tmp/doctrees docs \
		debian/python-nose2-doc/usr/share/doc/python-nose2-doc/html
	dh_sphinxdoc

override_dh_auto_install:
	dh_auto_install
	mv debian/python3-nose2/usr/bin/nose2 \
	   debian/python3-nose2/usr/bin/nose2-3

override_dh_installman:
	PYTHONPATH=$(CURDIR) help2man -n nose2 -s 1 -o debian/nose2.1 \
		 --version-string=$(PKG_VERSION) \
		 --no-discard-stderr --no-info \
		 debian/python-nose2/usr/bin/nose2
	PYTHONPATH=$(CURDIR) help2man -n nose2-3 -s 1 -o debian/nose2-3.1 \
		 --version-string=$(PKG_VERSION) \
		 --no-discard-stderr --no-info \
		 debian/python3-nose2/usr/bin/nose2-3
	cp debian/nose2.1   debian/nose2-2.7.1
	cp debian/nose2-3.1 debian/nose2-3.5.1
	dh_installman

override_dh_auto_test:
	dh_auto_test -- --system=custom --test-args="{interpreter} -m nose2.__main__ -v"
