#!/usr/bin/make -f

PY2_PACKAGE_NAME = python-schroot
PY3_PACKAGE_NAME = python3-schroot

PYVERS  = $(shell pyversions -r)
PY3VERS = $(shell py3versions -r)

%:
	dh $@ --with python2,python3

override_dh_auto_clean:
	dh_auto_clean
	rm -rvf ./*.egg-info ./build

override_dh_auto_build:
	set -xe; \
	for py in $(PYVERS) $(PY3VERS); do \
		$$py setup.py build; \
	done

override_dh_auto_install:
	set -xe; \
	for py in $(PYVERS); do \
		$$py setup.py install --skip-build --root debian/$(PY2_PACKAGE_NAME) \
		--install-layout deb; \
	done
	set -xe; \
		for py in $(PY3VERS); do \
		$$py setup.py install --skip-build --root debian/$(PY3_PACKAGE_NAME) \
		--install-layout deb; \
	done
	# Remove me when dh_python2 can handle this file
	rm -vf debian/*/usr/lib/python*/*-packages/*.egg-info/SOURCES.txt
