#!/usr/bin/make -f

export PYBUILD_NAME=pythonpy

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


override_dh_auto_build:
	dh_auto_build
	txt2man -s 1 -t py debian/docs/py.txt > debian/py.1


override_dh_auto_install:
	dh_auto_install -- --install-args "--install-lib=/usr/share/pythonpy --install-scripts=/usr/share/pythonpy"
	# This script is needed only when bash-completion is not available
	rm debian/pythonpy/usr/share/pythonpy/find_pycompletion.sh


override_dh_auto_test:
	# The test suite is composed of functional tests which are specified in "debian/tests/control" (DEP-8).


override_dh_fixperms:
	dh_fixperms
	chmod 755 debian/pythonpy/usr/share/pythonpy/pythonpy/__main__.py
	chmod 755 debian/pythonpy/usr/share/pythonpy/pythonpy/pycompleter.py


override_dh_python3:
	dh_python3
	sed -i 's,^#!/usr/bin/.*,#!/usr/bin/python3,' debian/pythonpy/usr/share/pythonpy/pythonpy/*.py
	rm -rf debian/pythonpy/usr/share/pythonpy/pythonpy-*.egg-info/
