#!/usr/bin/make -f

PYTHON2=$(shell pyversions -vr)
PYTHON3=$(shell py3versions -vr)

%:
	dh $@ --with python2,python3

# The tests have to be run from an installed package, thus DEP 8
# instead of the following.
#ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
#test-python%:
#	python$* /usr/bin/py.test --instafail
#
#override_dh_auto_test: $(PYTHON2:%=test-python%) $(PYTHON3:%=test-python%)
#endif

build-python%:
	python$* setup.py build

override_dh_auto_build: $(PYTHON3:%=build-python%)
	dh_auto_build

install-python%:
	python$* setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb

override_dh_auto_install: $(PYTHON3:%=install-python%)
	dh_auto_install

override_dh_installchangelogs:
	rst2html CHANGES.rst debian/tmp/CHANGES.html
	dh_installchangelogs -k debian/tmp/CHANGES.html

override_dh_installdocs:
	rst2html README.rst debian/tmp/README.html
	dh_installdocs

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build
	rm -rf *.egg-info
