#!/usr/bin/make -f

export PYBUILD_NAME=oncoref
export PYBUILD_SYSTEM=pyproject
export PYBUILD_DESTDIR=$(CURDIR)/debian/tmp
export PYBUILD_TEST_PYTEST=1
# Upstream's full suite needs downloaded expression/HPA and Ensembl data.
# Exercise the bundled tables and synthetic fixtures without network access.
export PYBUILD_TEST_ARGS=$(shell cat debian/tests/offline-tests)
# python3-pyarrow is only built for the default Python version, so the
# parquet cache tests cannot pass with the others.
export PYBUILD_TEST_ARGS_python3.15=$(PYBUILD_TEST_ARGS) \
	--deselect=tests/test_hpa.py::test_hpa_parquet_cache \
	--deselect=tests/test_load_dataset.py::test_reference_expression_parquet_cache_preserves_compact_dtypes
# Some upstream tests locate data relative to their own test directory.
# Under autopkgtest, point that location at the installed package.
ifeq ($(PYBUILD_AUTOPKGTEST),1)
export PYBUILD_BEFORE_TEST=ln -sfn /usr/lib/python3/dist-packages/oncoref {build_dir}/oncoref
endif
export MPLBACKEND=Agg
export XDG_CACHE_HOME=$(CURDIR)/debian/.test-cache
export MPLCONFIGDIR=$(XDG_CACHE_HOME)/matplotlib
export CANCERDATA_BUNDLED_DATA=$(XDG_CACHE_HOME)/bundle
export CANCERDATA_DATA_DIR=$(XDG_CACHE_HOME)/reference
export CANCERDATA_SOURCE_MATRICES=$(XDG_CACHE_HOME)/source-matrices
export PYENSEMBL_CACHE_DIR=$(XDG_CACHE_HOME)/pyensembl

build build-arch build-indep binary binary-arch binary-indep clean:
	dh $@ --buildsystem=pybuild

.PHONY: build build-arch build-indep binary binary-arch binary-indep clean
