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

NAME=twisted
case "$1" in
        configure|abort-upgrade|abort-remove|abort-deconfigure)
		dpkg --listfiles $NAME | grep '\.py$' | \
		     xargs -n 1 /usr/bin/python2.1 -c 'import py_compile,sys;py_compile.compile(sys.argv[1])'
		dpkg --listfiles $NAME | grep '\.py$' | \
		     xargs -n 1 /usr/bin/python2.1 -O -c 'import py_compile,sys;py_compile.compile(sys.argv[1])'
        ;;
esac
