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

#export DH_VERBOSE=1

export PYBUILD_NAME=pycoast
export PYBUILD_AFTER_TEST=rm -rf {build_dir}/pycoast/tests {build_dir}/*.png
export PYBUILD_TEST_ARGS=\
-k "not test_add_shapefile_shapes \
and not test_add_shapefile_shapes_agg \
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_points_pil \
and not test_config_file_points_and_borders_pil \
and not test_add_cities_pil \
and not test_add_cities_cfg_pil \
and not test_add_cities_from_dict_pil \
and not test_add_grid_from_dict_pil \
and not test_shapes[cw_pil-western_shapes_pil.png-area_def0-specific_kwargs0] \
and not test_shapes[cw_pil-eastern_shapes_pil.png-area_def1-specific_kwargs1] \
and not test_no_scratch[cw_pil-no_h_scratch_pil.png-shape0-area_def0-specific_kwargs0] \
and not test_no_scratch[cw_pil-no_v_scratch_pil.png-shape1-area_def1-specific_kwargs1]" \
$(CURDIR)/pycoast/tests

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	env PYTHONPATH=$(shell pybuild --build -i python3 -s custom --build-args 'echo {build_dir}') \
	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 \
	sphinx-build -N -E -T -b html docs/source $(CURDIR)/.pybuild/docs/html
	$(RM) -r $(CURDIR)/.pybuild/docs/html/.doctrees
	$(RM) -r $(CURDIR)/.pybuild/docs/html/_images
endif

override_dh_numpy3:
	dh_numpy3 -p python3-pycoast
