#!/usr/bin/make -f

#DH_VERBOSE=1

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

# Send HTTP traffic to “discard” service
export http_proxy = http://127.0.1.1:9/
export https_proxy = ${http_proxy}

%:
	dh $@ --with python2,python3

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	set -ex; for py in python2.7 $(PYTHON3); do \
		$$py -m unittest discover -v; \
	done;
endif

override_dh_auto_clean:
	rm -rf build keyring.egg-info
	find -type f -name *.pyc -delete

override_dh_auto_build:
	dh_auto_build
	set -ex; for py in $(PYTHON3) ; do \
		$$py setup.py build; \
	done;

override_dh_auto_install:
	dh_auto_install
	set -ex; for py in $(PYTHON3) ; do \
		$$py setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
	done;

override_dh_installchangelogs:
	dh_installchangelogs -k CHANGES.rst

get-orig-source:
	uscan --verbose --force-download --repack --rename
