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

export PYBUILD_NAME=nanosv

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

override_dh_auto_install:
	dh_auto_install
	find $(CURDIR)/debian -name "*.bed" -o -name "*.ini" | xargs -r chmod -x
	PYTHONPATH=./debian/nanosv/usr/lib/$(shell py3versions -d)/dist-packages/ help2man --include=debian/NanoSV.h2m ./debian/nanosv/usr/bin/NanoSV > $(CURDIR)/debian/NanoSV.1

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test -- --system=custom --test-args="PYTHONPATH={build_dir} {interpreter} -m nose -v"
endif

override_dh_auto_clean:
	dh_auto_clean
	rm -rf $(CURDIR)/debian/python3-nanosv*
	rm -f $(CURDIR)/debian/NanoSV.1
