#!/usr/bin/make -f
#export DH_VERBOSE = 1

SHELL := /bin/sh -e

DEBVERS ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
VERSION ?= $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/[+].*//' -e 's/~git.*//g' -e 's/~/./g')
export PBR_VERSION=$(VERSION)

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


%:
	dh $@  --with python3,sphinxdoc --buildsystem=pybuild

override_dh_auto_install:
	pkgos-dh_auto_install --no-py2

override_dh_install:
	rm -rf $(CURDIR)/debian/python*-networking-bgpvpn/usr/etc
	dh_install

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

override_dh_sphinxdoc:
	sphinx-build -b html doc/source debian/python-networking-bgpvpn-doc/usr/share/doc/python-networking-bgpvpn-doc/html
	dh_sphinxdoc -O--buildsystem=python_distutil

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