#! /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 \
and not test_multiple_extents \
and not test_null_datetime \
and not test_null_geometry \
and not test_relative_extension_path \
and not test_non_hierarchical_relative_link \
and not test_apply_bitfields \
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_set_field \
and not test_attributes \
and not test_modify \
and not test_collection_validate \
and not test_item_validate \
and not test_all \
and not test_required \
and not test_self_contained_catalog_collection_item_links \
and not test_assets \
and not test_spatial_allows_single_bbox \
and not test_invalid_error_message \
and not test_migrate_from_v2_0_0 \
and not test_migrate_from_v1_0_0 \
and not test_add_version \
and not test_version_in_properties \
and not test_add_not_deprecated_version \
and not test_add_deprecated_version \
and not test_latest \
and not test_predecessor \
and not test_successor \
and not test_collection_add_version \
and not test_catalog_add_version \
and not test_catalog_validate_all \
and not test_optional_version \
and not PointcloudTest \
and not SatTest \
and not ItemScientificExtensionTest \
and not CollectionScientificExtensionTest \
and not AssetStorageExtensionTest \
and not TimestampsTest \
and not ViewTest \
and not ProjectionTest \
and not test_get_schema_uri" \
--ignore=$(CURDIR)/tests/validation/test_validate.py \
--ignore=$(CURDIR)/tests/test_writing.py \
$(CURDIR)/tests


%:
	dh $@ --buildsystem=pybuild

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