#!/usr/bin/make -f

export PYBUILD_NAME=python-swiftclient

PYTHON3S:=$(shell py3versions -vr)

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

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

override_dh_install:
	set -e ; for pyvers in $(PYTHON3S); do \
		python$$pyvers setup.py install --install-layout=deb \
			--root $(CURDIR)/debian/python3-swiftclient ; \
	done

override_dh_installdocs:
	dh_installdocs
	dh_installdocs -A AUTHORS

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

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build .testrepository

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	pkgos-dh_auto_test --no-py2
endif

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