#!/usr/bin/make -f

%:
	dh --with python2,pypy --buildsystem=python_distutils $*

override_dh_auto_build:
	dh_auto_build --buildsystem=python_distutils -- --executable=/usr/bin/python
	pypy setup.py build --debug

override_dh_auto_install:
	dh_auto_install
	pypy setup.py install --root debian/tmp --install-layout deb
	rm -rf debian/tmp/usr/lib/pypy/bin
	# Install the python2 files to python-fastimport
	dh_install "debian/tmp/usr/lib/python*/*-packages" -p python-fastimport
	# Install the pypy files to pypy-fastimport
	dh_install "debian/tmp/usr/lib/pypy/" -p pypy-fastimport

ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	python -m testtools.run fastimport.tests.test_suite
	pypy -m unittest fastimport.tests.test_suite
endif
