[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Removing old .pyo/.pyc files in preinst ?



Howdy,

I am about to upload a brown-bag bug fix for python-rpy (dh_installdeb called
before dh_pycentral leading to no postinst code to link the new modules in,
doh; thanks to Keith, who is CCed as a courtesy, for spotting this).

However, there may well be old rpy files hanging around from prior python-rpy
version . Shall I remove these?  I have the draft debian/python-rpy.preinst
that is included below -- could one you of you good Debian Python folks wave
a cluebat at me indicating whether this is ok or whether it is rather frowned
upon?  Shall I remove the .pyo files only?  Or shall I go back into my cave
and continue coding in Perl as a punishment?

CCs encouraged as I am not a debian-python subscriber.

Cheers, and thanks in advance for any hints,  Dirk



#!/bin/sh
#
# prerinst script for the Debian GNU/Linux python-rpy package
#
# Copyright 2006 by Dirk Eddelbuettel <edd@debian.org>

set -e

case "$1" in
    install|upgrade)
	for f in rpy rpy_io rpy_options rpy_tools rpy_versions rpy_wintools; do
	    for e in pyc pyo; do
		for v in 2.3 2.4; do
		    if [ -f /usr/lib/python$v/site-packages/$f.$e ]; then
			rm -fv /usr/lib/python$v/site-packages/$f.$e
		    fi
		done
            done 
        done 
	;;

    abort-upgrade|disappear)
	;;

    *)
        echo "prerm called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac                 

exit 0



-- 
Hell, there are no rules here - we're trying to accomplish something. 
                                                  -- Thomas A. Edison



Reply to: