#!/usr/bin/make -f

export PYBUILD_NAME=pex
export DH_VERBOSE=1

export pkgversion=$(shell dpkg-parsechangelog --show-field version)


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

override_dh_auto_install:
	dh_auto_install
	# Use the Python 3 binary.
	mkdir -p debian/python-pex-cli/usr/bin
	mv debian/python3-pex/usr/bin/pex debian/python-pex-cli/usr/bin
	rm -rf debian/python3-pex/usr/bin
	rm -rf debian/python-pex/usr/bin

override_dh_installman:
	PYTHONPATH=$(CURDIR) help2man -n pex -s 1 -o debian/pex.1 \
		--version-string=$(pkgversion) \
		--no-discard-stderr --no-info \
		debian/python-pex-cli/usr/bin/pex
	dh_installman

# Disable docs and tests until upstream tarball includes them.

override_dh_installdocs:
	dh_installdocs
	echo "https://github.com/pantsbuild/pex/issues/51"

override_dh_autotest:
	dh_autotest
	echo "https://github.com/pantsbuild/pex/issues/51"

# override_dh_installdocs:
# 	python setup.py build_sphinx
# 	dh_installdocs
