#!/usr/bin/make -f

# python2-only build for resolute. resolute's dh-python 7.x has no python2
# support, so pybuild is unusable here; debhelper's own (deprecated but still
# shipped) python_distutils buildsystem drives setup.py directly and works with
# the dh_python2 shipped by our python-defaults backport.
%:
	dh $@ --with python2 --buildsystem python_distutils

# no versioned easy_install scripts
export SETUPTOOLS_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT = yes

override_dh_auto_test:

override_dh_auto_install:
	dh_auto_install

	# dh_pypy from dh-python < 1.20150705-1 falls over requires.txt
	# and our requires.txt aren't useful
	find debian/tmp -name requires.txt -delete

override_dh_installchangelogs:
	dh_installchangelogs CHANGES.rst

override_dh_auto_clean:
	# Keep entry_points, we need it to drive setup.py
	-mv setuptools.egg-info/entry_points.txt .
	dh_auto_clean
	mkdir -p setuptools.egg-info
	mv entry_points.txt setuptools.egg-info

	rm -rf .eggs docs/build

override_dh_install:
	rm -f debian/tmp/usr/bin/easy_install*
	dh_install

override_dh_installdocs:
	dh_installdocs -p python-pkg-resources docs/pkg_resources.txt
	dh_installdocs -p python-setuptools -X pkg_resources docs/*.txt
	dh_installdocs --remaining-packages
