#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

export PYBUILD_BEFORE_TEST = cp -a {dir}/nixio {dir}/docs {build_dir}
# FIXME: test_nix_compatibility.py needs NIX C++ headers to be runnable.
# NOTE: the documentation's examples skips expect non free Lenna picture.
export PYBUILD_TEST_ARGS = -v \
	-k 'not test_nix_compatibility.py \
	and not test_image_data \
	and not test_image_with_metadata \
	and not test_multiple_rois \
	and not test_single_roi'
export PYBUILD_AFTER_TEST = rm -rf {build_dir}/docs

%:
	dh $@ --buildsystem=pybuild

execute_before_dh_auto_build:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	python3 -m sphinx docs/source/ docs/_build/
endif

DTMP = $(CURDIR)/debian/tmp
execute_before_dh_installman: export PYTHONPATH=$(CURDIR)
execute_before_dh_installman:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	help2man $(DTMP)/usr/bin/nixio \
	        --name "command line interface for nixio tools" \
	        --version-string="$(DEB_VERSION_UPSTREAM)" \
	        --no-info \
	> debian/nixio.1
endif