#!/usr/bin/make -f

export PYBUILD_NAME=pip
export PYBUILD_DISABLE=python3
#export PYBUILD_VERBOSE=1
#export DH_VERBOSE=1

export PIP_NO_VENDOR_FOR_DOWNSTREAM=1

%:
	dh $@ --buildsystem=pybuild

# Upstream does not bundle enough of the source tree in the tarball to run the
# test suite.  https://github.com/pypa/pip/issues/3370
override_dh_auto_test:

override_dh_python2:
	dh_python2 -v
	rm -f debian/python-pip/usr/bin/pip
	rm -f debian/python-pip/usr/bin/pip2.?

override_dh_auto_install:
	dh_auto_install
	mkdir -p $(CURDIR)/debian/python2-pip-whl/usr/share/python-wheels

	# python-wheel isn't available any more, so we build it with Python 3
	python3 setup.py bdist_wheel \
		--universal \
		-d $(CURDIR)/debian/python2-pip-whl/usr/share/python-wheels

override_dh_installchangelogs:
	dh_installchangelogs NEWS.rst

override_dh_installman:
	mkdir -p debian/tmp
	rst2man debian/pip-manpage.rst > debian/tmp/pip2.man
	dh_installman

override_dh_clean:
	dh_clean
	rm -rf debian/tmp
