#!/usr/bin/make -f

export PYBUILD_NAME=tango

# TODO: Handle multiple python3 versions. For the moment, it builds against the
# default.
export PY3VER=$(shell py3versions -vd)
export PYBUILD_VERSIONS=${PY3VER}
export PYBUILD_INTERPRETERS=python${PY3VER}
# required to link against libboost that matches the same version than the
# python interpreter
export BOOST_PYTHON_SUFFIX=$(shell echo ${PY3VER} | tr -d .)

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

execute_after_dh_auto_clean:
	rm -rf build
	rm -rf *.egg-info
	rm -rf build

execute_after_dh_auto_build-indep:
	dh_auto_build --buildsystem=pybuild -- -s custom --build-args="PYTHONPATH={build_dir} {interpreter} -m sphinx -N -bhtml doc build/html"

override_dh_auto_install:
	dh_auto_install
	find -name "_tango.so.9*" -delete

override_dh_auto_test:
	PATH="/usr/lib/tango/:$$PATH" dh_auto_test --buildsystem=pybuild -- --test-pytest

execute_after_dh_installdocs-indep:
	dh_installdocs -p python-tango-doc "build/html"
	dh_installdocs -p python-tango-doc "examples"
