#!/usr/bin/make -f

export PYBUILD_NAME=erfa
export PYBUILD_TEST_ARGS=--pyargs ${PYBUILD_NAME}
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export PYERFA_USE_SYSTEM_LIBERFA=1

DEFAULT_PYVER=$(shell python3 -c "import sys;print('{}.{}'.format(*sys.version_info[:2]))")

include /usr/share/dpkg/pkg-info.mk
export SETUPTOOLS_SCM_PRETEND_VERSION=$(DEB_VERSION_UPSTREAM:+ds=)

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_build: export http_proxy=127.0.0.1:9
execute_after_dh_auto_build: export https_proxy=127.0.0.1:9
execute_after_dh_auto_build:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd docs && \
	PYTHONPATH=$(CURDIR)/.pybuild/cpython3_$(DEFAULT_PYVER)_erfa/build \
	python3 -m sphinx -N -E -T -b html $(CURDIR)/docs $(CURDIR)/.pybuild/docs/html
endif
