PKGBUILDs/community/gnuradio/gnuradio.install
2015-03-06 06:38:58 +00:00

52 lines
1.1 KiB
Plaintext

# 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$')"
update-desktop-database -q
}
post_install() {
post_upgrade $1
}
pre_remove() {
post_upgrade $1
}