#!/usr/bin/make -f

PYTHONS:=$(shell pyversions -vr)

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

override_dh_auto_install:
	set -e && for pyvers in $(PYTHONS); do \
		python$$pyvers setup.py install --install-layout=deb \
			--single-version-externally-managed --root $(CURDIR)/debian/python-repoze.what; \
	done
	rm -f $(CURDIR)/debian/python-repoze.what/usr/lib/python2*/dist-packages/repoze.what-*-nspkg.pth

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	sphinx-build -b html docs/source $(CURDIR)/debian/python-repoze.what/usr/share/doc/python-repoze.what/html
	dh_sphinxdoc -O--buildsystem=python_distutils
endif

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=. nosetests
endif

override_dh_clean:
	rm -rf .coverage
	dh_clean
