#!/usr/bin/make -f

export PYBUILT_NAME = josepy

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_build:
	find $(CURDIR) -print0 | xargs -0 touch -d@${SOURCE_DATE_EPOCH} '{}' \;
	dh_auto_build
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(CURDIR)/src \
		http_proxy='127.0.0.1:9' \
		https_proxy='127.0.0.1:9' \
		sphinx-build -N -bhtml docs/ build/html
endif

override_dh_auto_install:
	dh_auto_install
	find $(CURDIR)/debian/ -type d -name testdata -print0 | xargs -0 rm -rf '{}' \;
	rm -f $(CURDIR)/debian/tmp/usr/bin/jws

override_dh_installdocs:
	dh_installdocs --doc-main-package=python-josepy-doc -p python-josepy-doc
	dh_installdocs -p python3-josepy
