#!/usr/bin/make -f

export PYBUILD_NAME = elpy
LC_ALL := C.UTF-8
export LC_ALL
ELPY_TEST_DONT_USE_VIRTUALENV := t
export ELPY_TEST_DONT_USE_VIRTUALENV

%:
ifneq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
	echo -e "\nnodoc profile enabled, building without sphinxdoc..\n"
	dh $@ --with elpa,python3 --buildsystem=pybuild
else
	dh $@ --with elpa,python3,sphinxdoc --buildsystem=pybuild
endif

override_dh_auto_build: export http_proxy=127.0.0.1:9
override_dh_auto_build: export https_proxy=127.0.0.1:9
# docs are not generated without this override
override_dh_auto_build:
	dh_auto_build
# support the nodoc build profile
ifneq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
	echo -e "\nnodoc build profile enabled, therefore not building docs.\n"
else
	PYTHONPATH=. python3 -m sphinx -N -bman docs/ build/man
	PYTHONPATH=. python3 -m sphinx -N -btexinfo docs/ build/info
	makeinfo --no-split build/info/Elpy.texi -o build/info/elpy.info
	PYTHONPATH=. python3 -m sphinx -N -bhtml docs/ build/html
endif
