PKGBUILDs/community/gnuradio/gnuradio.install

54 lines
1.2 KiB
Text
Raw Normal View History

2015-03-06 06:38:58 +00:00
# clean up for anyone silly enough to run this as root
# it would be great if pkgname and not just pkgver was passed in the arg list
_pkg='gnuradio'
_cpython='cpython-34'
post_upgrade() {
while read _f; do
if [[ "${_f:(-3)}" != ".py" ]]; then
continue
fi
if [[ ! -f "$_f" ]]; then
continue
fi
if [[ -e "${_f}c" ]]; then
rm -f "${_f}c"
fi
if [[ -e "${_f}o" ]]; then
rm -f "${_f}o"
fi
continue
_thisdir="$(dirname "$_f")/__pycache__"
if [[ ! -d "$_thisdir" ]]; then
continue
fi
_thisfile="$(basename "$_f")"
_thisfile="${_thisfile/%.py/.${_cpython}.py}"
if [[ -e "${_thisdir}/${_thisfile}c" ]]; then
rm -f "${_thisdir}/${_thisfile}c"
fi
if [[ -e "${_thisdir}/${_thisfile}o" ]]; then
rm -f "${_thisdir}/${_thisfile}o"
fi
# no good way to test for empty dir
# would be 25% faster if there were
rmdir --ignore-fail-on-non-empty "$_thisdir" &> /dev/null
done <<< "$(pacman -Qql $_pkg | grep '\.py$')"
2015-08-08 04:23:48 +00:00
if [[ -e /usr/bin/update-desktop-database ]]; then
update-desktop-database -q
fi
2015-03-06 06:38:58 +00:00
}
post_install() {
post_upgrade $1
}
pre_remove() {
post_upgrade $1
}