#! /usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export PYBUILD_NAME=kerchunk

# python3-fastparquet module not available in Debian
SKIP_ARGS=not test_single_append_parquet \
and not test_zarr_combine

# tests requiring hdf5 plugins
# See https://github.com/fsspec/kerchunk/pull/575
SKIP_ARGS +=\
and not test_string_embed \
and not test_string_pathlib \
and not test_string_null \
and not test_string_decode \
and not test_compound_string_null \
and not test_compound_string_encode \
and not test_var

ifneq (,$(filter $(DEB_BUILD_ARCH),s390x))
SKIP_ARGS +=\
and not test_times[time-expected0] \
and not test_cftimes_to_normal \
and not test_hrrr_subhf_corrected_grib_tree
endif

export PYBUILD_TEST_ARGS=-v -m "not remotedata" -k "${SKIP_ARGS}" $(CURDIR)/tests
export PYBUILD_AFTER_TEST=${RM} -r {dir}/tests/__pycache__

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(CURDIR) http_proxy='http://127.0.0.1:9/' https_proxy='https://127.0.0.1:9/' \
	sphinx-build -N -E -T -b html docs/source $(CURDIR)/.pybuild/docs/html/
	${RM} -r $(CURDIR)/.pybuild/docs/html/.doctrees
endif
