#!/usr/bin/make -f

# workaround to avoid calling Scratchbox python2.3
PATH := /usr/bin:$(PATH)
export PATH
SBOX_REDIRECT_IGNORE = /usr/bin/python
export SBOX_REDIRECT_IGNORE

DEB_PYTHON_SYSTEM = pycentral

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk

# Add here any variable or target overrides you need.

DEB_DH_INSTALL_ARGS := --sourcedir=$(DEB_DESTDIR)
DEB_PYTHON_INSTALL_ARGS_ALL = --no-compile -O0

#install/python-hildon-tests::
#	cp -r $(CURDIR)/debian/runtests.sh $(CURDIR)/debian/tmp/usr/share/python-hildon-tests
#	chmod u+x $(CURDIR)/debian/tmp/usr/share/python-hildon-tests/runtests.sh

common-install-arch common-install-indep:: common-install-impl
common-install-impl::
	# Make scripts call pythonX.Y instead of just python (so they do not
	# call wrong python in Scratchbox)
	for f in `find $(DEB_DESTDIR) -type f`; do \
	    sed "1s,#\!.*python[^ ]*\(.*\),#\!/usr/bin/env $(shell pyversions -d)\1," $$f > $$f.tmp; \
	    cat $$f.tmp > $$f; \
	    rm $$f.tmp; \
	done

clean::
	rm -f hildon.c
	find -name "*.py[co]" | xargs -r rm
