#!/usr/bin/make -f

VERSION = $(shell PYTHONPATH=$PWD python3 -c 'import testpath; print(testpath.__version__)')

#export DH_VERBOSE=1
export PYBUILD_NAME=testpath
export PYBUILD_SYSTEM=custom
export PYBUILD_DISABLE=configure build clean
export PYBUILD_INSTALL_ARGS=mkdir -p {destdir}/usr/lib/python{version}/dist-packages/ && \
  cp -R testpath {destdir}/usr/lib/python{version}/dist-packages/ && \
  sed -e 's/VERSION/$(VERSION)/g' debian/testpath.egg-info > \
    {destdir}/usr/lib/python{version}/dist-packages/testpath-$(VERSION).egg-info
export PYBUILD_TEST_ARGS_python3=nosetests3

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

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=. python3 -m sphinx -b html doc debian/python-testpath-doc/usr/share/doc/python-testpath-doc/html
	dh_sphinxdoc -O--buildsystem=pybuild
endif
