#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export PYBUILD_NAME=tiledb
export PYBUILD_TEST_ARGS=-v -Wignore
export PYBUILD_BEFORE_TEST=cp -rv {dir}/tiledb/libtiledb.pyx {build_dir}/tiledb/libtiledb.pyx
export PYBUILD_AFTER_TEST=rm -rfv {build_dir}/tiledb/libtiledb.pyx {build_dir}/tiledb/tests
export PYBUILD_AFTER_INSTALL=rm -rf {destdir}{install_dir}/dask-worker-space {destdir}{install_dir}/.hypothesis


%:
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
	dh $@ --with python3,numpy3,sphinxdoc --buildsystem=pybuild
else
	dh $@ --with python3,numpy3 --buildsystem=pybuild
endif

override_dh_auto_clean:
	dh_auto_clean
	rm -f tiledb/version.py tiledb/libtiledb.cpp doc/source/_sidebar.rst.inc
	rm -rf .eggs .pytest_cache

override_dh_auto_build:
	dh_auto_build
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml doc/source build/html
endif

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_PROFILES)),)
	-dh_auto_test
endif
