#!/usr/bin/make -f

pkg = $(DEB_SOURCE_PACKAGE)
DEB_PYTHON_SUGAR_PACKAGES = $(pkg)

include /usr/share/cdbs/1/class/python-sugar.mk
include /usr/share/cdbs/1/rules/debhelper.mk

# Fix favor ISO 639-1 when differing from ISO 639-2
binary-post-install/$(pkg)::
	mv debian/$(cdbs_curpkg)/usr/share/locale/aym \
		debian/$(cdbs_curpkg)/usr/share/locale/ay
	mv debian/$(cdbs_curpkg)/usr/share/locale/ibo \
		debian/$(cdbs_curpkg)/usr/share/locale/ig

clean::
	find -name *.mo -delete
	find -name *.linfo -delete
	rm -f MANIFEST

# Fix broken paths in desktop file
#  * TODO: drop when fixed in sugar-toolkit-gtk3
binary-fixup/$(pkg)::
	find $(cdbs_curdestdir)/usr/share -type f -name '*.desktop' \
		-execdir perl -pi -e 's,^\S+\s*=\s*\K\S*(?=/usr/share),,g' '{}' ';'
