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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/dpkg/pkg-info.mk

export PYBUILD_NAME=satpy

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

override_dh_auto_configure:
	echo "version = '$(DEB_VERSION_UPSTREAM)'" > satpy/version.py
	dh_auto_configure

override_dh_fixperms:
	dh_fixperms
	find debian/python*satpy -name 'agri_l1.*' -exec chmod -x {} +

override_dh_auto_clean:
	dh_auto_clean

	$(RM) -r .eggs *.egg-info
	$(RM) test*.mitiff
	$(RM) -r .pytest_cache
	$(RM) satpy/version.py

override_dh_auto_build: export http_proxy=127.0.0.1:9
override_dh_auto_build: export https_proxy=127.0.0.1:9
override_dh_auto_build:
	dh_auto_build
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	PSP_CONFIG_FILE=$(CURDIR)/debian/pyspectral_dummycfg.yaml \
	PYTHONPATH=. python3 -m sphinx -N -bhtml doc/source build/html # HTML generator
	# PYTHONPATH=. python3 -m sphinx -N -bman doc/source build/man # Manpage generator
endif
