#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# copy the tests to the build dir to be able to pass nose
export PYBUILD_NAME=xrayutilities
export PYBUILD_BEFORE_TEST=cp -r examples {build_dir}
export PYBUILD_AFTER_TEST=rm -rf {build_dir}/examples

# get the default python3 interpreter version
PY3VER := $(shell py3versions -dv)

%:
	dh $@ --buildsystem=pybuild

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	dh_auto_build -- -s custom -p $(PY3VER) --build-args="env PYTHONPATH={build_dir} {interpreter} -m sphinx -N -bhtml doc/source build/html"
	dh_installdocs -p python-xrayutilities-doc build/html
	dh_sphinxdoc
	rm -rf build
endif
