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

#export DH_VERBOSE=1

export PYTHONPATH=$(CURDIR)

export PYBUILD_NAME=pycoast
export PYBUILD_BEFORE_TEST=cp -r {dir}/pycoast/tests/* {build_dir}/pycoast/tests
export PYBUILD_AFTER_TEST=rm -rf {build_dir}/pycoast/tests {build_dir}/*.png
export PYBUILD_TEST_ARGS=$(CURDIR)/pycoast/tests \
-k "not test_add_points_pil and not test_config_file_points_and_borders_pil \
and not test_add_shapefiles_from_dict_agg \
and not test_add_shapefiles_from_dict_pil \
and not test_add_one_shapefile_from_cfg_agg \
and not test_add_one_shapefile_from_cfg_pil \
and not test_add_cities_cfg_pil \
and not test_add_cities_from_dict_pil \
and not test_add_cities_pil \
and not test_add_grid_from_dict_pil \
and not test_eastern_shapes_pil \
and not test_no_h_scratch_pil \
and not test_no_v_scratch_pil \
and not test_western_shapes_pil"

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

override_dh_auto_build-indep:
	dh_auto_build -i
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd docs && \
	sphinx-build -N -E -T -b html . $(CURDIR)/.pybuild/docs/html/
	rm -rf $(CURDIR)/.pybuild/docs/html/.doctrees
endif

override_dh_auto_build:
	dh_auto_build --buildsystem=pybuild
	env http_proxy='http://127.0.0.1:9/' https_proxy='https://127.0.0.1:9/' \
	LC_ALL=C.UTF-8 LANGUAGE=C.UTF-8 \
	$(MAKE) -C docs html
	$(RM) -r docs/build/html/_images


override_dh_auto_clean:
	dh_auto_clean --buildsystem=pybuild
	$(MAKE) -C docs clean


override_dh_python3:
	dh_python3 -N python-pycoast-doc

override_dh_numpy3:
	dh_numpy3 -N python-pycoast-doc
