#!/usr/bin/make -f

export SETUPTOOLS_SCM_PRETEND_VERSION=$(DEB_VERSION_UPSTREAM)
export PYBUILD_NAME=pyepics
export NOLIBCA=1

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

execute_after_dh_auto_build:
	PYTHONPATH=. http_proxy='127.0.0.1:9' \
		python3 -m sphinx -N -b html doc build/html

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	dh_sphinxdoc -p python-pyepics-doc
endif

execute_after_dh_clean:
	$(RM) -r pyepics.egg-info

execute_before_dh_gencontrol:
	libca=$(shell dpkg-query -W -f '$${Depends}' libca-dev | awk '{print $$1}'); \
	libcom=$(shell dpkg-query -W -f '$${Depends}' libcom-dev | awk '{print $$1}'); \
	echo "lib:Depends=$$libca, $$libcom" >> debian/python3-pyepics.substvars
