#!/usr/bin/make -f
# -*- makefile -*-

export DH_OPTIONS
export PYBUILD_NAME=empy

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

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	./test.sh python2
	./test.sh python3
endif

override_dh_auto_install:
	dh_auto_install
	install -m 755 debian/python-empy/usr/lib/python2.*/dist-packages/em.py debian/python-empy/usr/bin/empy
	install -m 755 $$(ls debian/python3-empy/usr/lib/python3.*/dist-packages/em.py|head -1) debian/python3-empy/usr/bin/empy3
	# Replace shebang to avoid dependency on python2 (for some reason pybuild does not seem to do the rigth thing)
	sed -i -e 's:#!/usr/.*python.*:#!/usr/bin/python3:' debian/python3-empy/usr/bin/empy3
