#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

export PYBUILD_NAME=pyresample
export USE_CYTHON=True
export PYBUILD_TEST_ARGS=\
-k "not test_compare_to_legacy \
and not test_get_sample_from_bil_info_1d \
and not test_to_odc_geobox \
and not test_area_def_cartopy_installed \
and not test_area_repr_w_static_files \
and not test_area_repr_wo_static_files" \
--pyargs ${PYBUILD_NAME}

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_build: export http_proxy=127.0.0.1:9
execute_after_dh_auto_build: export https_proxy=127.0.0.1:9
execute_after_dh_auto_build:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	env PYTHONPATH=$(shell pybuild --print build_dir -i python3) \
	sphinx-build -N -E -T -b html $(CURDIR)/docs/source $(CURDIR)/.pybuild/docs/html
	$(RM) -r $(CURDIR)/.pybuild/docs/html/_static/images
	$(RM) -r $(CURDIR)/.pybuild/docs/html/.doctrees
else
	mkdir -p $(CURDIR)/.pybuild/docs/html
endif


override_dh_auto_install:
	dh_auto_install -ppython-pyresample-test --buildsystem=pybuild
	dh_auto_install -X.dat -X.npz --buildsystem=pybuild --remaining-packages
	$(RM) -r debian/python3-pyresample/usr/lib/python3*/dist-packages/pyresample/test/test_files
	$(RM) debian/python3-pyresample/usr/lib/python3*/dist-packages/test_areas.yaml

override_dh_installchangelogs:
	dh_installchangelogs README.md

override_dh_numpy3:
	dh_numpy3 -p python3-pyresample
