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

PY2VERS := $(shell pyversions -s)
PY3VERS := $(shell py3versions -s)

%:
	dh $@ --with python3

override_dh_auto_install:
	set -e ; \
	for python in $(PY2VERS); do \
		$$python setup.py install --no-compile -O0 --install-layout=deb \
			--root $(CURDIR)/debian/python-prettytable; \
	done

	set -e ; \
	for python in $(PY3VERS); do \
		$$python setup.py install --no-compile -O0 --install-layout=deb \
			--root $(CURDIR)/debian/python3-prettytable; \
	done

override_dh_auto_clean:
	set -e ; \
	for python in $(PY2VERS); do \
	    $$python setup.py clean -a; \
	done
	set -e ; \
	for python in $(PY3VERS); do \
	    $$python setup.py clean -a; \
	done
	find . -name \*.pyc -exec rm {} \;
	dh_clean

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	set -e ; \
	for python in $(PY2VERS) $(PY3VERS); do \
		PYTHONPATH=. $$python setup.py test ; \
	done
endif

override_dh_installdocs:
	dh_installdocs -A README
