#!/usr/bin/make -f

# See https://wiki.debian.org/Python/Pybuild .

export DH_VERBOSE=1
export PYBUILD_NAME=libisds

export PYBUILD_SYSTEM=custom
export PYBUILD_BEFORE_CLEAN=cp -r {dir} {dir}_{interpreter}
export PYBUILD_CLEAN_ARGS=cd {dir}_{interpreter}; pwd; rm -rf {build_dir}/python{version}/

export PYBUILD_BEFORE_CONFIGURE=echo Configure in {dir}_{interpreter}
export PYBUILD_CONFIGURE_ARGS=cd {dir}_{interpreter}; pwd; PYTHON_VERSION={version} ./configure

export PYBUILD_BEFORE_BUILD=echo Build in {dir}_{interpreter}
export PYBUILD_BUILD_ARGS=cd {dir}_{interpreter}; pwd; make
# Build the documentation using Python 2.
export PYBUILD_AFTER_BUILD_python2=cd {dir}_{interpreter}; pwd; make doc; cp -r docs/build/ {dir}/docs/

export PYBUILD_BEFORE_INSTALL=echo Install in {dir}_{interpreter}
export PYBUILD_INSTALL_ARGS=cd {dir}_{interpreter}; pwd; make -j1 install DESTDIR={dir}/debian/tmp AM_UPDATE_INFO_DIR=no

export PYBUILD_BEFORE_TEST=echo Test in {dir}_{interpreter}
export PYBUILD_TEST_ARGS=cd {dir}_{interpreter}; pwd; make test

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