#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export LC_ALL=C.UTF-8

PY2VERS := $(shell pyversions -r -v)

%:
	dh $@ --with python2 --buildsystem=python_distutils

override_dh_auto_build:
	set -e; \
	for py in $(PY2VERS); do  \
	    python$$py setup.py build; \
	done

# The test suite needs pytest, pretend and flaky, none of which are packaged
# for python2 on resolute. The Sphinx docs are python3-only.
override_dh_auto_test:

override_dh_auto_clean:
	-for py in $(PY2VERS); do \
	    python$$py setup.py clean --all; \
	done

	rm -rf build

	rm -rf *.key *.pem tmp*

	dh_clean build-stamp version.pyc

override_dh_auto_install: DH_OPTIONS=
override_dh_auto_install:
	set -e; \
	for py in $(PY2VERS); do \
	    echo "installing for python$$py ..."; \
	    python$$py setup.py install --root=$(CURDIR)/debian/python-openssl --install-layout=deb; \
	done

override_dh_installchangelogs:
	dh_installchangelogs CHANGELOG.rst
