#!/usr/bin/make -f

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

%:
	dh $@ --buildsystem=python_distutils --with python3

override_dh_clean:
	dh_clean

override_dh_auto_clean:
	python3 setup.py clean

override_dh_install:
	echo "Do nothing..."

override_dh_auto_test:
	echo "Do nothing..."

override_dh_auto_build:
	echo "Do nothing..."

override_dh_auto_install:
	pkgos-dh_auto_install --no-py2

ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	set -e ; set -x ; for PYVER in $(PYTHON3S); do \
		PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/dist-packages \
			PYTHON=python$$PYVER \
			python$$PYVER -m pytest tests/unit ; \
	done
endif

	dh_install
	
#	rm -rf $(CURDIR)/debian/python3-rally/usr/etc
#	mv $(CURDIR)/debian/python3-rally/usr/bin $(CURDIR)/debian/rally/usr

	mkdir -p $(CURDIR)/debian/python3-rally-openstack/etc/rally
	oslo-config-generator --output-file $(CURDIR)/debian/python3-rally-openstack/etc/rally/rally-openstack.conf \
		--namespace rally \
		--namespace rally_openstack \
		--namespace oslo.db \
		--namespace oslo.log

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3
	rm -rf $(CURDIR)/debian/python3-rally-openstack/usr/share/doc/python3-rally-openstack/rally-jobs/plugins/__pycache__
	rm -rf $(CURDIR)/debian/python3-rally-openstack/usr/share/doc/python3-rally-openstack/rally-jobs/plugins/test_relative_import/__pycache__
