#!/usr/bin/make -f

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

%:
	dh $@ --buildsystem=pybuild


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 enough time to investigate; it might be due to
	# Jupyter attempting to use the user's HOME directory to store
	# it's configuration (despite $$HOME being set to something sane).
	# test_comms.py is also breaking, and reported upstream to
	# https://github.com/jupyter/qtconsole/issues/511
	dh_auto_test -- --test-args="-k \"not test_00_console_widget and not test_comms.py\""
endif

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

ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
execute_after_dh_auto_build:
	cd docs && PYTHONPATH=$(CURDIR) $(MAKE) html

execute_after_dh_installdocs:
	dh_installdocs -p python-qtconsole-doc docs/build/html --doc-main-package=python3-qtconsole
endif
