summaryrefslogtreecommitdiffstats
path: root/ubuntu/raring/dependencies/python-tqt/debian/python-tqt-dev.preinst
blob: b17b35a44a936de24e0a9cd813cf32f3c114537a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
# TODO: remove this file after releasing Squeeze
set -e
if [ "$1" = upgrade ]
then
	if dpkg --compare-versions "$2" lt 3.17.6-2; then
	    if which python >/dev/null 2>&1 && which pycentral >/dev/null 2>&1; then
		pycentral pkgremove python-qt-dev
	    else
		flist=$(tempfile)
		find /usr/share/pycentral/python-qt-dev -depth -mindepth 2 \
		    \( -name '*.py' -printf 'p %P\n' -o -printf '%y %P\n' \) \
		    > $flist 2>/dev/null || true
		    if [ -s $flist ]; then
			for d in /usr/lib/python[0-9].[0-9]; do
			    case "$d" in */python2.1|*/python2.2) continue; esac
			    while read t n; do
				case "$t" in
				    p) rm -f $d/$n $d/${n}[co];;
				    d) rmdir $d/$n 2>/dev/null || true;;
				    *) rm -f $d/$n
				esac
			    done < $flist
			done
		    fi
		    rm -f $flist
		    dpkg -L python-qt-dev \
			| awk '/\/usr\/share\/pycentral/ {next} /\.py$/ {print $0"c\n" $0"o"}' \
			| xargs rm -f >&2
	    fi
	fi
fi

#DEBHELPER#