#!/usr/bin/make -f

PY2VERS := $(shell pyversions -s)

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

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

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

# The test suite needs python-mock, which is not packaged for python2 here.
override_dh_auto_test:

override_dh_installchangelogs:
	dh_installchangelogs HISTORY.rst

# python-psutil-doc is dropped: building it needs Sphinx, which is python3-only.
override_dh_installdocs:
	dh_installdocs -X.DS_Store

override_dh_compress:
	dh_compress -X.py

override_dh_strip:
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
	dh_strip -ppython-psutil --dbg-package=python-psutil-dbg
endif
