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

export PYBUILD_NAME=asdf
export ASDF_TEST_BUILD=yes
export SETUPTOOLS_SCM_PRETEND_VERSION=${DEB_VERSION_UPSTREAM}
export PY_IGNORE_IMPORTMISMATCH=1 # https://stackoverflow.com/questions/44067609

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

override_dh_auto_test:
	dh_auto_test
	rm -f .pybuild/*/build/*.asdf

override_dh_installdocs:
	python3 setup.py build_sphinx
	dh_installdocs

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

override_dh_auto_install:
	dh_auto_install
	mkdir -p debian/asdftool/usr
	mv debian/python3-asdf/usr/bin debian/asdftool/usr
	rm -rf debian/python3-asdf/usr/lib/python3.7/dist-packages/asdf/reference_files/generate
