#!/usr/bin/make -f
#export DH_VERBOSE = 1
export HOME=$(CURDIR)
export PYBUILD_NAME=mapclassify
export PYBUILD_TEST_CUSTOM=1

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
# tests ignored due to maintaining external connection at build time
	pytest -v --ignore=mapclassify/tests/test_greedy.py --ignore=mapclassify/tests/test_rgba.py
	dh_auto_test
endif

# Build sphinx HTML documentation
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
execute_after_dh_auto_build:
	PYTHONPATH=. http_proxy='http://127.0.0.1:9/' python3 -m sphinx -N -bhtml docs/ debian/html
endif

download_remote_intersphinx_inventories:
	curl https://matplotlib.org/stable/objects.inv -o debian/intersphinx/matplotlib_objects.inv
	curl https://geopandas.org/en/stable/objects.inv -o debian/intersphinx/geopandas_objects.inv
	curl https://networkx.org/documentation/stable/objects.inv -o debian/intersphinx/networkx_objects.inv

execute_before_dh_link-indep:
	jdupes -rl debian/python-mapclassify-doc
