#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_build:
	# Pure Python scripts; nothing to build.

override_dh_auto_install:
	install -dm 0755 debian/cdgtools/usr/share/cdgtools
	install -dm 0755 debian/cdgtools-gui/usr/share/cdgtools
	install -m 0644 cdgtools.py cdgdao.py cdgparse.py cdgcddb.py \
		cdgrip.py cdg2bin.py cdg2text.py \
		debian/cdgtools/usr/share/cdgtools/
	install -dm 0755 debian/cdgtools/usr/bin
	for tool in cdgrip cdg2bin cdg2text; do \
		printf '#!/bin/sh\nexec python3 /usr/share/cdgtools/%s.py "$$@"\n' "$$tool" \
			> debian/cdgtools/usr/bin/$$tool; \
		chmod 0755 debian/cdgtools/usr/bin/$$tool; \
	done
	install -m 0644 cdggui.py debian/cdgtools-gui/usr/share/cdgtools/cdggui.py
	install -dm 0755 debian/cdgtools-gui/usr/bin
	printf '#!/bin/sh\nexec python3 /usr/share/cdgtools/cdggui.py "$$@"\n' \
		> debian/cdgtools-gui/usr/bin/cdggui
	chmod 0755 debian/cdgtools-gui/usr/bin/cdggui

override_dh_auto_test:
	python3 -m py_compile cdgtools.py cdgdao.py cdgparse.py cdgcddb.py \
		cdgrip.py cdg2bin.py cdg2text.py
