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

PYTHON2:=$(shell pyversions -vr)
PYTHON3:=$(shell py3versions -vr)
export PYBUILD_NAME=asdf
export http_proxy=127.0.0.1:9

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

override_dh_installdocs:
	python3 setup.py build_sphinx
	dh_installdocs

override_dh_install:
	dh_install
	rm -rf debian/python-asdf/usr/bin/
	mkdir -p debian/asdftool/usr
	mv debian/python3-asdf/usr/bin debian/asdftool/usr/bin

override_dh_fixperms:
	dh_fixperms
	chmod -x debian/*/usr/lib/python*/dist-packages/asdf/tests/data/example_schema.json

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
test-python%:
	python$* setup.py test -vv --args -v

override_dh_auto_test: $(PYTHON2:%=test-python%) $(PYTHON3:%=test-python%)
endif
