#!/usr/bin/make -f

export PYBUILD_NAME=fabio

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

override_dh_clean:
        # remove the cython generated files distributed by upstream
	rm -f $(patsubst %.pyx,%.c,$(wildcard src/*.pyx))
	rm -rf build/html
	rm -rf *.egg-info
	dh_clean

override_dh_auto_build:
	dh_auto_build
	PYBUILD_SYSTEM=custom \
	PYBUILD_BUILD_ARGS="PYTHONPATH={build_dir} http_proxy='localhost' sphinx-build -N -bhtml doc/source build/html" dh_auto_build  # HTML generator

# unactive test for now
override_dh_auto_test:
#	PYBUILD_SYSTEM=custom \
#	PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} {interpreter} test/test_all.py" dh_auto_test

override_dh_install:
	dh_numpy
	dh_install

	# remove the /bin part of the -dbg package which conflict with
	# non-dbg packages
	rm -rf debian/python-fabio-dbg/usr/bin

override_dh_installman:
	dh_installman -p python-fabio doc/man/fabio_viewer.1

override_dh_installdocs-indep:
	# install the documentation
	dh_installdocs "build/html" -p python-fabio-doc
