#!/usr/bin/make -f

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

export PYBUILD_NAME=rasterio
export PYBUILD_BEFORE_TEST= cp -r {dir}/tests {build_dir}

export PYBUILD_AFTER_TEST=rm -rf {build_dir}/tests
export PYBUILD_TEST_PYTEST=1

%:
	dh $@ --with python3 --buildsystem pybuild --parallel

override_dh_clean:
	dh_clean

	$(RM) rasterio/*.c
	$(RM) rasterio/_*.cpp
	$(RM) VERSION.txt
	$(RM) gdal-config.txt
	$(RM) .coverage

override_dh_auto_test:
	dh_auto_test || echo "Ignoring test failures"

override_dh_install:
	dh_install --list-missing

	$(RM) -r debian/python3-rasterio/usr/bin

	$(RM) -r debian/*/usr/lib/python*/dist-packages/.hypothesis/

override_dh_python3:
	dh_python3 -ppython3-rasterio -prasterio
	dh_numpy3 -ppython3-rasterio -prasterio

debian/rasterio.1:
	help2man rasterio -N -L en_US.utf8 -n "command line tools for reading/writing geospatial raster data" >debian/rasterio.1
