#!/usr/bin/make -f

include /usr/share/openstack-pkg-tools/pkgos.make

export OSLO_PACKAGE_VERSION=$(shell dpkg-parsechangelog | grep Version: | cut -d' ' -f2 | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~/.0/' | head -n 1)

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

override_dh_clean:
	dh_clean
	rm -rf cover

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=. nosetests -v test/unit --exe
endif

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=. sphinx-build -b html doc/source debian/swauth-doc/usr/share/doc/swauth-doc/html
	dh_sphinxdoc -O--buildsystem=python_distutils
	rm debian/swauth-doc/usr/share/doc/swauth-doc/html/_sources/license.txt
endif
