#!/usr/bin/make -f
# -*- mode: makefile -*-

SPACE :=
SPACE +=

export PYBUILD_NAME=pyaudio

PYTHONPATH=$(subst $(SPACE),:,$(abspath $(wildcard build/lib*)))

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

export PYBUILD_TEST_ARGS = tests --ignore=tests/host_device_api_tests.py \
    --ignore=tests/mac_core_stream_info_tests.py \
    --ignore=tests/error_tests.py \
    --deselect=tests/deprecation_tests.py::DeprecationTests::test_deprecated_stream

%:
	dh $@ $(DH_ADDONS) --buildsystem=pybuild

build binary %-indep: DH_ADDONS=--with=linktree

override_dh_clean:
	dh_clean
	$(RM) -rf src/PyAudio.egg-info
	$(RM) -rf debian/doctrees

override_dh_auto_build-indep:
	PYTHONPATH=$(PYTHONPATH) make docs

override_dh_auto_test:
	# PYAUDIO_SKIP_HW_TESTS=1 dh_auto_test
	@echo "Skipping test suite: pyaudio tests require a functional ALSA/PortAudio device, unavailable in the build environment."

override_dh_installdocs:
	dh_installdocs --doc-main-package=python3-pyaudio -ppython-pyaudio-doc

override_dh_auto_clean:
	dh_auto_clean
	rm -rf docs
