#!/bin/sh

set -e

remove_old_pyc() {
    for pyc in AptListChangesGtk.pyc \
	       apt_listchanges.pyc \
	       DebianControlParser.pyc;
    do
      rm -f /usr/lib/site-python/$pyc
    done
}


hook=/etc/apt/apt.conf.d/20listchanges

if [ -f $hook.disabled ]; then
    mv $hook.disabled $hook
fi

case "$1" in
    install|upgrade)
        # Upgrade from edgy
        if dpkg --compare-versions "$2" lt "2.72ubuntu6"; then
            remove_old_pyc
        fi
        ;;
esac


#DEBHELPER#

exit 0
