On Thu, Oct 18, 2001 at 07:25:04PM +0200, Matthias Klose wrote: > hmm, seems I've been kicked of the debian lists. anyway, could you > implement the scripts for your c) proposal? would it be a good idea to > put the debian directories under CVS control, so we have access to it?
And I thought perhaps I'd been annoying people too much and people had redirected my posts to /dev/null :-) I've not look in my mail till now, and there seems to be a plethora of people posting solutions. I feel we are starting to approach the point of too many cooks, and am tempted to back out rather than add more confusion. Now that Neil is back, I see he has posted that he has some scripts ready for this, and I'd trust that his are worth using. However, if you are still interested, I have started down the path of experimenting with various preinst and prerm scripts based on the 2.1 packages in unstable. Even if you don't want to use them, they might provide ideas. The files attached are; pythonX.Y-base.postinst pythonX.Y-base.prerm postinst and prerm scripts should be usable for all pythonX.Y-base packages, just redefine VERSION at the start. update-python A script to be called by version independant python packages in their postinst and postrm scripts. This should probably be provided by the python-base package. Note that these scripts are _untested_. They assume the following directory structure; /usr/lib/pythonX.Y/ pythonX.Y installation directory /usr/lib/python/ version independant packages installation directory /usr/local/lib/python/X.Y local version dependant modules /usr/local/lib/python/ local version independant modules They create and compile symlinks into the relevant */python/ directory in */pythonX.Y/ directories. They also clean up dangling symlinks and any associated *.pyc or *.pyo files. They have some minor deficiencies, the biggest being any directorys created in */pythonX.Y/ directories during symlink creation will not be cleaned up. This is a bit tricky, as it is hard to determine when directories are created for symlinks, and when they are created by some other package. Note that these scripts are very simple and would be easy to modify. In particular, I'm not familiar with any /usr/local/python conventions, so they probably need adjusting there. -- ---------------------------------------------------------------------- ABO: finger [EMAIL PROTECTED] for more info, including pgp key ----------------------------------------------------------------------
#! /bin/sh -e # # postinst script for the Debian python2.1-base package. # Written 1998 by Gregor Hoffleit <[EMAIL PROTECTED]>. # Modified 2001 by Donovan Baarda <[EMAIL PROTECTED]>. # VERSION=2.1 PACKAGE=python${VERSION}-base case "$1" in configure|abort-upgrade|abort-remove|abort-deconfigure) # Create /usr/local/lib/python/site-packages and # /usr/local/lib/pythonX.Y/site-packages if needed # /usr/local/lib/pythonX.Y/ is for local version dependant packages # /usr/local/lib/python/ is for local version independant packages for i in python python/site-packages python${VERSION} python${VERSION}/site-packages; do if [ ! -e /usr/local/lib/$i ]; then mkdir -p /usr/local/lib/$i 2> /dev/null || true chmod 2775 /usr/local/lib/$i 2> /dev/null || true chown root:staff /usr/local/lib/$i 2> /dev/null || true fi done # Update symlinks to /usr/lib/python/ and /usr/local/lib/python # in /usr/lib/pythonX.Y/ and /usr/local/lib/pythonX.Y/. # This will remove all dangling symlinks and any related *.pyc # and *.pyo files. It will create absolute symlinks for everything # in the */python/ directories. Any files that already exist in the # */pythonX.Y/ directories will be left untouched. for i in /usr/lib/python /usr/local/lib/python; do find $i${VERSION}/ -type l -not \ \( -xtype f -or -xtype d -or -xtype l \) \ -exec rm -f \{\} \{\}o \{\}c \; 2> /dev/null || true cp -Rs $i/* $i${VERSION}/ 2> /dev/null || true done # Compile everything in /usr/lib/pythonX.Y and /usr/local/lib/pythonX.Y for i in /usr/lib/python${VERSION} /usr/local/lib/python${VERSION} ; do /usr/bin/python${VERSION} -O /usr/lib/python${VERSION}/compileall.py -q $i /usr/bin/python${VERSION} /usr/lib/python${VERSION}/compileall.py -q $i done ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac if [ "$1" = "configure" ]; then ldconfig fi # Automatically added by dh_installdocs if [ "$1" = "configure" ]; then if [ -d /usr/doc -a ! -e /usr/doc/python2.1-base -a -d /usr/share/doc/python2.1-base ]; then ln -sf ../share/doc/python2.1-base /usr/doc/python2.1-base fi fi # End automatically added section # Automatically added by dh_installmenu if [ "$1" = "configure" -a -x /usr/bin/update-menus ]; then update-menus ; fi # End automatically added section exit 0
#! /bin/sh -e # # prerm script for the Debian python2.1-base package. # Written 1998 by Gregor Hoffleit <[EMAIL PROTECTED]>. # Modified 2001 by Donovan Baarda <[EMAIL PROTECTED]>. # VERSION=2.1 PACKAGE=python${VERSION}-base # Remove all symlinks into */python/ directories and any corresponding # compiled *.pyc and *.pyo files for i in /usr/lib/python /usr/local/lib/python ; do find $i${VERSION} -type l -lname $i/'*' \ -exec rm -f \{\} \{\}c \{\}\o \; # Remove compiled *.pyc and *.pyo files corresponding to # *.py files installed by this package. dpkg --listfiles $PACKAGE | awk '$0~/\.py$/ {print $0"c\n" $0"o"}' | xargs rm -f >&2 # remove the /usr/local/lib/python/site-packages and # /usr/local/lib/pythonX.Y/site-packages directories. rmdir /usr/local/lib/python/site-packages 2>/dev/null && \ rmdir /usr/local/lib/python 2>/dev/null || \ true rmdir /usr/local/lib/python${VERSION}/site-packages 2>/dev/null && \ rmdir /usr/local/lib/python${VERSION} 2>/dev/null || \ true # Automatically added by dh_installdocs if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/python2.1-base ]; then rm -f /usr/doc/python2.1-base fi # End automatically added section
#! /bin/sh -e # # update-python script for the Debian python-base package. # Created 2001 by Donovan Baarda <[EMAIL PROTECTED]>. # # Update symlinks to /usr/lib/python/ and /usr/local/lib/python # in all /usr/lib/pythonX.Y/ and /usr/local/lib/pythonX.Y/. # This will remove all dangling symlinks and any related *.pyc # and *.pyo files. It will create absolute symlinks for everything # in the */python/ directories. Any files that already exist in the # */pythonX.Y/ directories will be left untouched. for i in /usr/lib/python /usr/local/lib/python; do for v in $i*.*; do find $v/ -type l -not \ \( -xtype f -or -xtype d -or -xtype l \) \ -exec rm -f \{\} \{\}o \{\}c \; 2> /dev/null || true cp -Rs $i/* $v/ 2> /dev/null || true PYTHON=`basename $v` # Compile everything in */pythonX.Y /usr/bin/${PYTHON} -O /usr/lib/${PYTHON}/compileall.py -q $v /usr/bin/${PYTHON} /usr/lib/${PYTHON}/compileall.py -q $v done done exit 0