#!/usr/bin/make -f

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

export PYBUILD_NAME=geopandas
ifeq ($(PYBUILD_AUTOPKGTEST),1)
export PYBUILD_BEFORE_TEST=cp -v debian/nybb_*.zip examples/ && cp -rv examples/ {build_dir} && cp -rv geopandas/ {build_dir}
else
export PYBUILD_BEFORE_TEST=cp -v debian/nybb_*.zip examples/ && cp -rv examples/ {build_dir} && mkdir -p {build_dir}/geopandas/tests/ && cp -rv geopandas/tests/data/ {build_dir}/geopandas/tests/
endif
export PYBUILD_AFTER_TEST=rm -rfv {build_dir}/examples/ {build_dir}/tests/data/ && rm -f examples/nybb_*.zip
export PYBUILD_TEST_ARGS=-v \
 --ignore=geopandas/io/tests/test_file.py \
 --ignore=geopandas/tests/test_geocode.py \
 --ignore=geopandas/tests/test_overlay.py \
 --ignore=geopandas/tests/test_plotting.py \
 geopandas/

%:
	dh  $@ --buildsystem pybuild

execute_after_dh_auto_install:
	# Remove README with privacy-breach issues
	$(RM) debian/*/usr/lib/python*/dist-packages/geopandas/datasets/naturalearth_cities/naturalearth_cities.README.html
	$(RM) -r debian/*/usr/lib/python*/dist-packages/examples