#!/usr/bin/make -f

PYTHONS:=$(shell pyversions -vr)

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

export OSLO_PACKAGE_VERSION=$(VERSION)

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

override_dh_install:
	set -e && for pyvers in $(PYTHONS); do \
		python$$pyvers setup.py install --install-layout=deb \
			--root $(CURDIR)/debian/python-oslo.rootwrap; \
	done
	rm -f $(CURDIR)/debian/python*-oslo.rootwrap/usr/lib/python*/dist-packages/*.pth

override_dh_clean:
	dh_clean -O--buildsystem=python_distutils
	rm -rf .testrepository build

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	python setup.py build_sphinx
	cp -rf doc/build/html $(CURDIR)/debian/python-oslo.rootwrap-doc/usr/share/doc/python-oslo.rootwrap-doc
	dh_sphinxdoc -O--buildsystem=python_distutils
endif