#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@ --with python2,python3

override_dh_auto_install:
	set -e && for pyvers in $(shell pyversions -vr); do \
	   python$$pyvers setup.py install --no-compile -O0 --install-layout=deb \
	        --root $(CURDIR)/debian/python-prettytable; \
	    python$$pyvers $(CURDIR)/prettytable.py; \
	done
	2to3 -w $(CURDIR)/prettytable.py
	set -e && for pyvers in $(shell py3versions -sv); do \
	    python$$pyvers setup.py install --no-compile -O0 --install-layout=deb \
	        --root $(CURDIR)/debian/python3-prettytable; \
	    python$$pyvers $(CURDIR)/prettytable.py; \
	done
	mv $(CURDIR)/prettytable.py.bak $(CURDIR)/prettytable.py

override_dh_auto_clean:
	set -e && for pyvers in $(shell pyversions -vr); do \
	    python$$pyvers setup.py clean -a; \
	done
	set -e && for pyvers in $(shell py3versions -sv); do \
	    python$$pyvers setup.py clean -a; \
	done
	find . -name \*.pyc -exec rm {} \;
	dh_clean

