mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-18 22:54:00 +00:00
53 lines
1.2 KiB
Text
53 lines
1.2 KiB
Text
|
|
# 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-35'
|
|
|
|
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$')"
|
|
|
|
if [[ -e /usr/bin/update-desktop-database ]]; then
|
|
update-desktop-database -q
|
|
fi
|
|
}
|
|
|
|
post_install() {
|
|
post_upgrade $1
|
|
}
|
|
|
|
pre_remove() {
|
|
post_upgrade $1
|
|
}
|
|
|