#!/bin/sh -e

# Source debconf library.
. /usr/share/debconf/confmodule

if [ "$1" = "configure" ]; then
	if [ -d /usr/doc -a ! -e /usr/doc/dput -a -d /usr/share/doc/dput ]; then
		ln -sf ../share/doc/dput /usr/doc/dput
	fi
fi

PV=`dpkg --listfiles python2.1 | sed -n -e '/^\/usr\/lib\/python.*\//{
  s,/usr/lib/python\([0-9][0-9.]*\)/.*,\1,p
  q
}'`
PYTHON=python$PV
DIR='/usr/share/dput/'

case "$1" in
	configure|abort-upgrade|abort-remove|abort-deconfigure)
		/usr/bin/$PYTHON -O /usr/lib/python$PV/compileall.py -q $DIR
		/usr/bin/$PYTHON /usr/lib/python$PV/compileall.py -q $DIR
	;;
	*)
		echo "postinst called with unknown argument \`$1'" >&2
		exit 1
	;;
esac
