#!/usr/bin/make -f
#export DH_VERBOSE=1
#export DEB_BUILD_OPTIONS=nocheck
export PYBUILD_NAME=numba

export PYBUILD_INSTALL_ARGS=--install-scripts=/usr/share/{package}

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

override_dh_auto_install:
	dh_auto_install
	# remove the unwanted file for python2 package
	find debian/python-numba -type f -name annotation_usecases.py -delete

override_dh_auto_test:
	PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="cd {build_dir} && {interpreter} -Wd -m pytest numba/tests -v -rs" dh_auto_test || true

override_dh_installchangelogs:
	dh_installchangelogs -A CHANGE_LOG

override_dh_installdocs:
	dh_installdocs -A README.rst
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	cp -a docs CHANGE_LOG examples .pybuild/pythonX.Y_2.7/build
	http_proxy='127.0.0.1:9' sphinx-build -N -bhtml .pybuild/pythonX.Y_2.7/build/docs/source/ debian/numba-doc/usr/share/doc/numba-doc/html/
endif

override_dh_python2:
	dh_python2
	dh_numpy

override_dh_python3:
	dh_python3
	dh_numpy3

override_dh_compress:
	dh_compress -X.ipynb -X.ods -X.py # save examples and notebooks
