#!/usr/bin/make -f

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

export OSLO_PACKAGE_VERSION=$(VERSION)

%:
	dh $@ --with python2

override_dh_auto_configure:
	echo $(VERSION) > novaclient/versioninfo
	dh_auto_configure

override_dh_auto_clean:
	echo $(VERSION) > novaclient/versioninfo
	dh_auto_clean
	rm -f novaclient/versioninfo
	rm -rf .testrepository subunit.log

override_dh_auto_install:
	dh_auto_install
	install -D -m 0644 tools/nova.bash_completion $(CURDIR)/debian/python-novaclient/etc/bash_completion.d/nova.bash_completion
	rm -rf $(CURDIR)/debian/python-novaclient/usr/novaclient

override_dh_auto_test::
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	set -e && \
		TEMP_REZ=`mktemp -t` && \
		python setup.py testr --slowest --testr-args='--subunit  ' | tee $$TEMP_REZ | subunit2pyunit ; \
		cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
		rm -f $$TEMP_REZ
endif
