#!/usr/bin/make -f

PYTHON3S:=$(shell py3versions -vrs)
export OSLO_PACKAGE_VERSION=$(shell dpkg-parsechangelog -SVersion | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//' -e 's/~/.0/' -e 's/+dfsg1//' | head -n 1)

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

override_dh_auto_clean:
	rm -rf build .stestr
	find . -iname '*.pyc' -delete
	for i in $$(find . -type d -iname __pycache__) ; do rm -rf $$i ; done

override_dh_auto_build:
	echo "Do nothing..."

override_dh_auto_test:
	echo "Do nothing..."

override_dh_auto_install:
	set -x ; set -e ; for pyvers in $(PYTHON3S) ; do \
		python$$pyvers setup.py install --install-layout=deb --root $(CURDIR)/debian/gertty ; \
	done
	rm -f $(CURDIR)/debian/gertty/usr/lib/python3*/dist-packages/gertty/alembic/README

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