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

include /usr/share/cdbs/1/rules/buildcore.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk

clean::
	# This is normally done in python-distutils.mk (cdbs)
	# but we dont use it so we have to do it manually.
	 find . -name '*.py[co]' -exec rm '{}' ';'

binary-fixup/getmail4::
	dh_pysupport
	#dh_python /usr/share/getmail4
	dh_fixperms

binary-predeb/getmail4::
	# Change #!/usr/bin/env python to #!/usr/bin/python
	find debian/getmail4/usr/bin -type f -name getmail\* -exec sed -i -e 's|#!.*python.*|#!/usr/bin/python|g' {} \;
	# Fix permissions
	find debian/getmail4/usr/share/getmail4/ -type f -name '*.py' | xargs chmod 644
