#!/usr/bin/make -f

DH_VERBOSE := 1

include /usr/share/dpkg/default.mk

bindir   := $(CURDIR)/debian/$(DEB_SOURCE)/usr/bin
examples := $(CURDIR)/debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/examples

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

export PYBUILD_NAME=qcli


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

# 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
