#!/bin/sh set -e syssite=/usr/lib/@PVER@/site-packages oldsite=/usr/lib/@PVER@/old-site-packages localsite=/usr/local/lib/@PVER@/dist-packages syslink=../../${localsite#/usr/*} move_site_packages() { if [ ! -d $localsite ]; then if ! mkdir -p $localsite; then echo >&2 "unable to create $localsite. Skip moving $syssite contents to new location" exit 1 fi fi if [ -h $syssite ]; then : elif [ -d $syssite ]; then for i in $(find $syssite -mindepth 1 -maxdepth 1 -printf '%P\n'); do echo "Moving $syssite/$i to new location:" if [ ! -e $localsite/$i ]; then echo " --> $localsite/$i" mv $syssite/$i $localsite/ elif [ ! -e $oldsite/$i ]; then echo " --> $oldsite/$i (already exist in $localsite/" mv $syssite/$i $oldsite/ else echo " already exists in $localsite/ and $oldsite/" echo " please proceed manually" exit 1 fi done echo "removing $syssite" rmdir $syssite #echo "symlinking $syssite to $localsite" #ln -s $syslink $syssite else : #ln -sf $syslink $syssite fi } case "$1" in install) # there never was a python2.6 package using site-packages. #if [ -n "$2" ] && dpkg --compare-versions "$2" lt '2.6.1-0'; then # move_site_packages #fi if [ -z "$2" ] && [ -d $syssite ] && [ ! -h $syssite ]; then echo "new installation of @PVER@-minimal; $syssite is a directory" echo "which is expected a symlink to $localsite." echo "please find the package shipping files in $syssite and" echo "file a bug report to ship these in /usr/lib/@PVER@/dist-packages instead" echo "aborting installation of @PVER@-minimal" exit 1 fi # remember newly installed runtime mkdir -p /var/lib/python touch /var/lib/python/@PVER@_installed ;; upgrade) # there never was a python2.6 package using site-packages. #if [ -n "$2" ] && dpkg --compare-versions "$2" lt '2.6.1-0'; then # move_site_packages #fi : ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0