#!/usr/bin/make -f
# -*- makefile -*-
export PYBUILD_NAME = mne
# The below environment variables are important test parameters.
export HOME = $(CURDIR)/build
export MNE_DONTWRITE_HOME = true
export MNE_SKIP_SAMPLE_DATASET_TESTS = true
export MNE_FORCE_SERIAL = true
export MNE_SKIP_NETWORK_TESTS = 1
# to avoid cannot set toolkit to qt4 because it has already been set to wx
export ETS_TOOLKIT = qt4

%:
	dh $@ --buildsystem pybuild

execute_before_dh_clean:
	rm -rf *.egg-info

# FIXME: reinstate these tests with resolution of [1].
# [1]: https://github.com/mne-tools/mne-python/issues/13193
PYTEST_SPECS = -k 'not test_spherical_conversions and not test_tps'
SCREEN_CONFIG=-screen 0 1024x768x24 -ac +extension GLX +render -noreset
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	mkdir -p build
	xvfb-run \
		--auto-servernum \
		--server-num=20 \
		-s "$(SCREEN_CONFIG)" \
		py.test $(PYTEST_SPECS) -s -v mne
endif

execute_after_dh_fixperms:
	find `find debian -name data -type d` -type f -exec chmod -x \{\} \;