#!/usr/bin/make -f

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

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

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

override_dh_auto_install:
	pkgos-dh_auto_install --no-py2

override_dh_install:
	# NOTE: generate configuration files directly
	for file in `ls etc/oslo-config-generator/*`; do \
		 PYTHONPATH=$(CURDIR) oslo-config-generator --config-file=$$file \
			--output-file=etc/neutron/`basename $$file`; \
	done
	# 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

ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	pkgos-dh_auto_test --no-py2
endif

override_dh_auto_clean:
	rm -rf .testrepository build
	for file in `ls etc/oslo-config-generator/*`; do rm -f etc/neutron/`basename $$file`; done
	dh_auto_clean

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3
