#! /usr/bin/make -f

export PYBUILD_NAME=yarl
export PYBUILD_BEFORE_BUILD=cython3 yarl/_quoting_c.pyx
export LC_ALL=C.UTF-8
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

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

override_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd docs && \
	PYTHONPATH=$(CURDIR) http_proxy='http://127.0.0.1:9/' https_proxy='https://127.0.0.1:9/' \
	python3 -m sphinx -N -E -T -b html . $(CURDIR)/.pybuild/docs/html/
	rm -rf $(CURDIR)/.pybuild/docs/html/.doctrees
endif

override_dh_auto_test-indep:

override_dh_auto_install:
	dh_auto_install
	find debian/python3-yarl/usr/lib \( -name '*.c' -or -name '*.px[di]' -or -name '*.pyx' \) -delete
