#!/usr/bin/make -f

DH_VERBOSE := 1

pkg      := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
bindir   := $(CURDIR)/debian/$(pkg)/usr/bin
examples := $(CURDIR)/debian/$(pkg)/usr/share/doc/$(pkg)/examples

pybuilddir := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)-$(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)

%:
	dh $@ --with python2

# we only need this package as qiime dependency - there is no point in bloating /usr/bin with these scripts
override_dh_installexamples:
	mv $(bindir) $(examples)

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	set -e -x;\
	for pyv in `pyversions -dv` ; do \
	    cd build/; \
	    ln -s ../python-code/tests; \
	    env PYTHONPATH=lib.$(pybuilddir)-$${pyv} nosetests ; \
	done
endif

get-orig-source:
	mkdir -p ../tarballs
	uscan --verbose --force-download --destdir=../tarballs
