#!/usr/bin/make -f
#DH_VERBOSE = 1

PYVISA_VERSION = $(shell dpkg -s python3-pyvisa | grep Version: | cut -c 10-)

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

override_dh_auto_clean:
	$(RM) -r PyVISA_py.egg-info
	$(RM) -r build
	dh_auto_clean

#override_dh_auto_build:
#	dh_auto_build
#	set -ex; for python in $(shell py3versions -r); do \
#	    $$python setup.py build; \
#	done

#override_dh_auto_install:
#	dh_auto_install
#	set -ex; for python in $(shell py3versions -r); do \
#	    $$python setup.py install --install-layout=deb \
#	    --root $(CURDIR)/debian/tmp; \
#	done;

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	if dpkg --compare-versions $(PYVISA_VERSION) lt 1.11.3-1 ; then \
	  echo "Skipping test since pyvisa version is older than 1.11.3-1" ; \
	  echo "This is needed to solve a cyclic dependency problem causing problems with migration to testing" ; \
	else \
	  dh_auto_test; \
	fi
endif
