#!/usr/bin/make -f

export DH_VERBOSE = 1

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

export PYBUILD_NAME = nextcloud-api

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

execute_after_dh_auto_install:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(shell pybuild --print {build_dir} --interpreter python3) \
	HTTP_PROXY='http://127.0.0.1:9/' HTTPS_PROXY='https://127.0.0.1:9/' \
	python3 -m sphinx -b html docs $(CURDIR)/debian/python-$(PYBUILD_NAME)-doc/usr/share/doc/python-$(PYBUILD_NAME)-doc/html
	rm -rf $(CURDIR)/debian/python-$(PYBUILD_NAME)-doc/usr/share/doc/python-$(PYBUILD_NAME)-doc/html/.doctrees
endif
