#!/usr/bin/make -f

export PYBUILD_NAME=python-glanceclient

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

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

override_dh_auto_install:
	pkgos-dh_auto_install --no-py2

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3

override_dh_auto_clean:
	dh_auto_clean -O--buildsystem=pybuild
	rm -rf .testrepository build doc/man

override_dh_install:
	dh_install -O--buildsystem=pybuild
	rm -rf $(CURDIR)/debian/python-glanceclient/usr/glanceclient

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	pkgos-dh_auto_test --no-py2 --exclude-list=$(CURDIR)/debian/tests-exclude.txt
endif

override_dh_installman:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	sphinx-build -b man doc/source doc/man
	dh_installman -O--buildsystem=pybuild
endif

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