#!/usr/bin/make -f

export PYBUILD_NAME=pyina

export PYBUILD_TEST_CUSTOM=1
export PYBUILD_TEST_ARGS={interpreter} -m pyina.tests

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

# This package relies on MPI for the tests, so we do not try running them
override_dh_auto_test:

execute_after_dh_installexamples:
	perl -i -pe 's%/usr/bin/env python%/usr/bin/python3%' debian/python3-pyina/usr/share/doc/python3-pyina/examples/*.py

ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
execute_after_dh_auto_build:
	PYTHONPATH=$(CURDIR) $(MAKE) -C docs SPHINXBUILD=sphinx-build html

execute_after_dh_auto_clean:
	$(MAKE) -C docs SPHINXBUILD=sphinx-build clean

override_dh_installdocs:
	dh_installdocs -ppython-pyina-doc --doc-main-package=python3-pyina
	dh_installdocs --remaining-packages
	mv debian/python-pyina-doc/usr/share/doc/python3-pyina/build debian/python-pyina-doc/usr/share/doc/python3-pyina/html
endif
