#! /usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export UPSTREAM_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')

export PYBUILD_NAME=pystac
export PYBUILD_TEST_ARGS=-k "\
not test_read_remote \
and not test_validate_all \
and not test_validate_all_with_max_n \
and not test_validate_all_with_recusive_off \
and not test_testcases \
and not test_validate_examples \
and not test_validate_all \
and not test_set_field \
and not test_label \
and not test_item_asset \
and not test_null_geometry \
and not test_non_hierarchical_relative_link \
and not test_apply_bitfields \
and not test_validate_classification \
and not test_validate \
and not test_set_variables \
and not test_set_dimensions \
and not test_asset_bands \
and not test_bands \
and not test_cloud_cover \
and not test_validate_eo \
and not test_validate_collection \
and not test_validate_item \
and not test_attributes \
and not test_modify \
and not test_asset_bands \
and not test_validate_raster \
and not test_collection_validate \
and not test_retry_stac_io \
and not test_item_validate \
and not test_all \
and not test_required \
and not PointcloudTest \
and not ItemScientificExtensionTest \
and not CollectionScientificExtensionTest \
and not ItemVersionExtensionTest \
and not CollectionVersionExtensionTest \
and not SatTest \
and not ViewTest \
and not TimestampsTest \
and not AssetStorageExtensionTest \
and not ProjectionTest"

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

execute_after_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd docs && \
	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 . $(CURDIR)/.pybuild/docs/html/
	rm -rf $(CURDIR)/.pybuild/docs/html/.doctrees
endif
