#!/usr/bin/make -f

export PYBUILD_NAME=qtconsole
export PYBUILD_AFTER_INSTALL=rm -rf {destdir}/usr/bin/

ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
%:
	dh $@ --with sphinxdoc --buildsystem=pybuild

override_dh_sphinxdoc:
	cd docs && PYTHONPATH=$(CURDIR) $(MAKE) html
	dh_installdocs docs/build/html -p python-qtconsole-doc --doc-main-package=python3-qtconsole
	dh_sphinxdoc -O--buildsystem=pybuild

else
%:
	dh $@ --buildsystem=pybuild

endif

execute_after_dh_clean:
	rm -rf docs/build

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	# Skip the console test which segfaults
	# I do not have enought time to investigate.
	dh_auto_test -- --test-args="-k \"not test_00_console_widget\""
endif

execute_after_dh_auto_install:
	# install scripts into jupyter-qtconsole
	python3 setup.py install_scripts -d debian/jupyter-qtconsole/usr/bin
