#!/usr/bin/make -f

PYTHONS:=$(shell pyversions -vr)

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

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

override_dh_auto_build:
	dh_auto_build -O--buildsystem=python_distutils

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	ostestr
endif

override_dh_auto_install:
	python setup.py install --root=debian/tmp --install-layout=deb

override_dh_install:
	dh_install --fail-missing

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

override_dh_auto_clean:
	dh_auto_clean
	rm -f debian/*.init debian/*.service debian/*.upstart
	rm -rf build
	rm -rf barbican.sqlite
	rm -rf .eggs
