#!/usr/bin/make -f
#export DH_VERBOSE=1

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

override_dh_auto_clean:
	rm -rf $(CURDIR)/build
	rm -rf $(CURDIR)/turses.1
	rm -rf $(CURDIR)/turses.egg-info

override_dh_clean:
	dh_clean
	rm -fr debian-sphinx-tmp
	find . -name '*.pyc' -delete

override_dh_auto_build:
	dh_auto_build
	# The $$HOME directory isn't guaranteed to exist at build time.
	# This causes a FTBFS since sphinx creates an instance of the
	# Configuration class, which tries to create $${HOME}/.turses
	# if it doesn't exist.
	[ -d debian-sphinx-tmp ] || mkdir debian-sphinx-tmp
	HOME=debian-sphinx-tmp python setup.py build_sphinx

override_dh_installman:
	rst2man docs/user/manpage.rst turses.1
	dh_installman

override_dh_installchangelogs:
	dh_installchangelogs HISTORY.rst
