#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

include /usr/share/cdbs/1/rules/debhelper.mk
DEB_PYTHON_SYSTEM = pysupport
include /usr/share/cdbs/1/class/python-distutils.mk

DEB_COMPRESS_EXCLUDE := .py

# In order to regenerate 'debian/control' :
#    DEB_AUTO_UPDATE_DEBIAN_CONTROL=yes fakeroot debian/rules clean
# Then check manually if everything's ok

install/python-soya::
	# fix unnecessary versionned shebang
	sed -i 's/^#! *\/usr\/bin\/python[0-9.]\+/#! \/usr\/bin\/python/' debian/$(cdbs_curpkg)/usr/bin/*
	# move data to usr/share
	mv debian/$(cdbs_curpkg)/usr/lib/python$(cdbs_python_current_version)/site-packages/soya/data/* \
		debian/$(cdbs_curpkg)/usr/share/$(cdbs_curpkg)
	rm -rf debian/$(cdbs_curpkg)/usr/lib/python*/site-packages/soya/data
	# avoid font duplication
	rm debian/$(cdbs_curpkg)/usr/share/python-soya/FreeSans.ttf
	dh_link -p$(cdbs_curpkg) usr/share/fonts/truetype/freefont/FreeSans.ttf \
		usr/share/python-soya/FreeSans.ttf
	# remove unneeded execute bit
	find debian/$(cdbs_curpkg)/usr/share/ -type f -exec chmod -R a-x {} \;

clean::
	rm -f debian/pycompat
	rm -f _soya.c
