#!/usr/bin/make -f

export PYBUILD_TEST_ARGS=\
-k "not test_collection_with_invalid_name \
and not test_valid_item \
and not test_collection_invalid_asset \
and not test_external_pc_data \
and not test_one_datetime \
and not test_fsspec_io \
and not test_external_data_https" \
tests

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd docs && \
	env PYTHONPATH=$(shell pybuild --print build_dir -i python3) \
	http_proxy='http://127.0.0.1:9/' https_proxy='https://127.0.0.1:9/' \
	sphinx-build -N -E -T -b html . $(CURDIR)/.pybuild/docs/html
	rm -rf $(CURDIR)/.pybuild/docs/html/.doctrees
	sed -i 's%https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js%file:///usr/share/javascript/requirejs/require.min.js%' \
	`find $(CURDIR)/.pybuild/docs/html -type f -name '*.html'`
endif

override_dh_python3:
	dh_python3 -N python-stactools-doc
