#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PACKAGE = python3-mecavideo

%:
	dh $@ --with python3

override_dh_clean:
	find . -type d -name __pycache__ | xargs rm -rf
	dh_clean

override_dh_auto_install:
	$(MAKE) DESTDIR=$(CURDIR)/debian/$(PACKAGE) install-for-debian
	python3 setup.py install --root $(CURDIR)/debian/$(PACKAGE)
	# remove redundant icons and video files
	find $(CURDIR)/debian/$(PACKAGE)/usr/lib -name icones -type d | xargs rm -rf
	find $(CURDIR)/debian/$(PACKAGE)/usr/lib -name video -type d | xargs rm -rf
	# remove files make_exe.py from the distribution
	find $(CURDIR)/debian/$(PACKAGE) -name make_exe.py | xargs rm -f

override_dh_auto_test:
	cd test && xvfb-run python3 pymecavideoTest.py

override_dh_compress:
	dh_compress -X.xhtml
