#!/usr/bin/make -f
#export DH_VERBOSE = 1

export PYBUILD_NAME=pybel

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

override_dh_auto_install:
	dh_auto_install
	# To avoid conflict with Python3 version
	rm -rf $(CURDIR)/debian/python-pybel/usr/bin
	# eliminate lintian warning
	for d in $$(find $(CURDIR)/debian/python3-pybel/usr/lib -maxdepth 1 -type d -name "python3.*"); \
	do \
	   chmod -x $$d/dist-packages/pybel/testing/resources/bel/*.json ; \
	done
	find debian -type f -name graph_template.html \
	    | xargs sed -i \
		-e 's;https://cdn[js]*\..*/jquery.min.js;file:///usr/share/javascript/jquery/jquery.min.js;g' \
		-e 's;https://cdn[js]*\..*/d3.min.js;file:///usr/share/javascript/d3/d3.min.js;g' \

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	echo "I: Not testing since https://github.com/pybel/bel-resources is not packaged yet."
endif

override_dh_auto_clean:
	dh_auto_clean
	rm -rf src/PyBEL.egg-info/ src/pybel.egg-info/
