#!/usr/bin/make -f

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

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

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	NOSE_WITH_OPENSTACK=1 \
		NOSE_OPENSTACK_COLOR=1 \
		NOSE_OPENSTACK_RED=0.05 \
		NOSE_OPENSTACK_YELLOW=0.025 \
		NOSE_OPENSTACK_SHOW_ELAPSED=1 \
		DJANGO_SETTINGS_MODULE=senlindash_board.test.settings \
		python3-coverage run \
		$(CURDIR)/manage.py test senlin_dashboard --settings=senlin_dashboard.test.settings
endif

override_dh_auto_build:
	echo "Do nothing..."

override_dh_auto_clean:
	python3 setup.py clean

override_dh_clean:
	dh_clean
	rm -rf .coverage*

override_dh_auto_install:
	pkgos-dh_auto_install --no-py2

	# Activates the senlin_dashboard plugin in Horizon
	# senlin_dashboard/enabled/_5*
	mkdir -p $(CURDIR)/debian/python3-senlin-dashboard/usr/lib/python3/dist-packages/openstack_dashboard/enabled
	cp $(CURDIR)/senlin_dashboard/enabled/_5* $(CURDIR)/debian/python3-senlin-dashboard/usr/lib/python3/dist-packages/openstack_dashboard/enabled
	mkdir -p $(CURDIR)/debian/python3-senlin-dashboard/usr/share/openstack-dashboard/openstack_dashboard/enabled
	cp $(CURDIR)/senlin_dashboard/enabled/_5*.py $(CURDIR)/debian/python3-senlin-dashboard/usr/share/openstack-dashboard/openstack_dashboard/enabled
