#!/usr/bin/make -f

export PYBUILD_NAME = openshot-qt
export PYBUILD_DESTDIR = debian/openshot-qt
export TMPDIR = $(CURDIR)/debian/openshot-qt
export PYBUILD_TEST_CUSTOM = 1
export PYBUILD_TEST_COMMAND = PYTHONPATH={build_dir}/openshot_qt:{build_dir}:$$PYTHONPATH {interpreter} -m unittest discover -v -s openshot_qt/tests -p "*_tests.py" && PYTHONPATH={build_dir}/openshot_qt:{build_dir}:$$PYTHONPATH {interpreter} -m unittest discover -v -s openshot_qt/language -p "test_*.py"

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_build:
	PYTHONPATH=. http_proxy='127.0.0.1:9' python3 -m sphinx -N -b html -d build/doctrees doc build/html
	PYTHONPATH=. http_proxy='127.0.0.1:9' python3 -m sphinx -N -b man  -d build/doctrees doc build/man

execute_after_dh_auto_install:
	# Extra license file must not be removed, otherwise crash will happen
	# Removal line patched out. See https://bugs.debian.org/908320
	#rm $(TMPDIR)/usr/lib/python3*/dist-packages/openshot_qt/resources/license.txt
	chmod -x \
		$(TMPDIR)/usr/lib/python3*/dist-packages/openshot_qt/presets/format_mp4_librav1e.xml \
		$(TMPDIR)/usr/lib/python3*/dist-packages/openshot_qt/presets/format_mp4_libsvtav1.xml

execute_after_dh_auto_clean:
	rm -rf build
