#!/usr/bin/make -f

PY = $(shell pyversions -d)
PYVER = $(shell pyversions -vd)

DEB_PYTHON_SYSTEM = pycentral

# workaround to force using pythonX.Y inside Scratchbox
# this is a internal variable from /usr/share/cdbs/1/class/python-distutils.mk
cdbs_python_compile_version = $(PYVER)

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-layout=deb

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

common-install-arch common-install-indep:: common-install-impl
common-install-impl::
	# Force interpreter version to $(PYVER)
	for f in `find $(DEB_DESTDIR) -type f`; do \
	    sed "1s,#\!.*python[^ ]*\(.*\),#\!/usr/bin/env $(PY)\1," $$f > $$f.tmp; \
	    cat $$f.tmp > $$f; \
	    rm $$f.tmp; \
	done

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