#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

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

override_dh_install:
	# NOTE: scrub usr/etc folder from install.
	rm -rf debian/python-neutron-fwaas/usr/etc
	dh_install

override_dh_fixperms:
	find debian/python-neutron-fwaas -name __init__.py -exec chmod a-x {} \;
	dh_fixperms

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	rm -rf .testrepository
	testr init && \
	set -e && \
	TEMP_REZ=`mktemp -t` && \
	testr run --subunit neutron_fwaas.tests.unit | tee $$TEMP_REZ | subunit2pyunit; \
	rm -f $$TEMP_REZ ;
endif

override_dh_autoclean:
	rm -rf .testrepository
	dh_autoclean

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