#! /usr/bin/make -f

#export DEB_BUILD_OPTIONS=nocheck
export DEB_BUILD_MAINT_OPTIONS=nocheck

export PYBUILD_NAME=biomaj-download
%:
	dh $@ --buildsystem=pybuild

override_dh_clean:
	dh_clean
	rm -rf biomaj_download.egg-info
	if [ -e biomaj_download/message/downmessage_pb2.py.bak ] ; then mv biomaj_download/message/downmessage_pb2.py.bak biomaj_download/message/downmessage_pb2.py; fi

override_dh_auto_configure:
	cp -a biomaj_download/message/downmessage_pb2.py biomaj_download/message/downmessage_pb2.py.bak
	dh_auto_configure

override_dh_auto_build:
	cd biomaj_download/message && protoc --python_out=. downmessage.proto
	dh_auto_build

override_dh_install:
	dh_install
	sed -i '1s;^;#!/usr/bin/python3\n;' debian/python3-biomaj3-download/usr/bin/biomaj_download_consumer.py

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	LOCAL_IRODS=0 NETWORK=0 python3 -m pytest -v tests/biomaj_tests.py
endif
