#!/usr/bin/make -f

export PYBUILD_NAME = hypercorn
export PYBUILD_TEST_ARGS = --ignore=tests/test_app_wrappers.py --ignore=tests/middleware/test_dispatcher.py

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

execute_after_dh_fixperms:
	find $(CURDIR)/debian/python3-hypercorn/usr/lib/python3 -type f -exec chmod 0644 {} \;

execute_before_dh_installman:
	PYTHONPATH=src help2man --no-discard-stderr -n "ASGI Server based on Hyper libraries and inspired by Gunicorn" $(CURDIR)/debian/python3-hypercorn/usr/bin/hypercorn >hypercorn.1

execute_before_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$$(pybuild --print build_dir |awk '{print $$3}') python3 -m sphinx -b html -d $(CURDIR)/docs/.build/.doctrees -N $(CURDIR)/docs $(CURDIR)/debian/python-hypercorn-doc/usr/share/doc/python-hypercorn-doc/html
endif

execute_after_dh_clean:
	rm -rf $(CURDIR)/docs/.build
