#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1


PYTHONS:=$(shell pyversions -vr)
PYTHON3S:=$(shell py3versions -vr)

%:
	dh $@  --with python2,python3 --buildsystem=pybuild

override_dh_install:
	set -ex && for pyvers in $(PYTHONS); do \
	     python$$pyvers setup.py install --install-layout=deb \
	        --root $(CURDIR)/debian/python-requests-unixsocket; \
	done
	set -ex && for pyvers in $(PYTHON3S); do \
	     python$$pyvers setup.py install --install-layout=deb \
	        --root $(CURDIR)/debian/python3-requests-unixsocket; \
	done

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	set -e && set -x && \
	for i in 2.7 $(PYTHON3S) ; do \
	    echo "===> Testing for python$$i" ; \
	    PYTHONPATH=$(CURDIR) py.test-$$i requests_unixsocket/tests ;\
	done
endif

override_dh_auto_clean:
	rm -rf __pycache__
