#!/usr/bin/make -f

PY3VERS := $(shell py3versions -s)

export PYBUILD_AFTER_BUILD=$(MAKE) -C docs html PYTHON=python3

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

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


override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="PYTHONWARNINGS=all PSUTIL_TESTING=1 PSUTIL_DEBUG=1 PYTHONPATH={build_dir} {interpreter} psutil/tests/runner.py || true" dh_auto_test
endif

override_dh_installchangelogs:
	dh_installchangelogs HISTORY.rst

override_dh_installdocs:
	dh_installdocs -X.DS_Store
	dh_installdocs -ppython-psutil-doc docs/_build/html README.rst

override_dh_compress:
	dh_compress -X.py
