#!/usr/bin/make -f

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

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

export UPSTREAM_VERSION=$(DEB_VERSION_UPSTREAM)
export PYBUILD_NAME=salib

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

execute_before_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(CURDIR)/src python3 -m sphinx -b html -d $(CURDIR)/docs/.build/.doctrees -N $(CURDIR)/docs $(CURDIR)/debian/python-salib-doc/usr/share/doc/python-salib-doc/html
endif

execute_before_dh_clean:
	$(RM) -rf $(CURDIR)/docs/.build $(CURDIR)/docs/api

execute_before_dh_installman:
	PYTHONPATH=$(CURDIR)/src argparse-manpage \
		--pyfile $(CURDIR)/src/SALib/scripts/salib.py \
		--function get_parser \
		--prog salib \
		--format pretty \
		--project-name SALib \
		--version $(DEB_VERSION_UPSTREAM) \
		--description "Sensitivity Analysis Library in Python. Contains Sobol, Morris, FAST, and other methods." \
		--author "Jon Herman, Will Usher and Takuya Iwanaga" \
		--url https://github.com/SALib/SALib \
		--output $(CURDIR)/salib.1
