hooks/rewrite-python-shebang: simplify and check for unset $off correctly.
This commit is contained in:
parent
947966bd76
commit
054a73caf2
1 changed files with 4 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
|||
# - rewrites python shebangs with the corresponding python version
|
||||
|
||||
hook() {
|
||||
local pyver= shebang= warn=
|
||||
local pyver= shebang= warn= off=
|
||||
|
||||
case $pkgname in
|
||||
python-*)
|
||||
|
@ -26,11 +26,10 @@ hook() {
|
|||
shebang="#!/usr/bin/python$pyver"
|
||||
find ${PKGDESTDIR} -type f -print0 | \
|
||||
xargs -0 grep -H -b -m 1 "^#!.*\([[:space:]]\|/\)python\([[:space:]]\|$\)" -- | while IFS=: read -r f off _; do
|
||||
[ "$off" -a "$off" -eq 0 ] || continue
|
||||
[ -z "$off" ] && continue
|
||||
if [ "$warn" ]; then
|
||||
msg_warn "$pkgname: multiple python versions defined!"
|
||||
msg_warn "$pkgname: using $pyver for shebang"
|
||||
warn=
|
||||
msg_warn "$pkgver: multiple python versions defined! (using $pyver for shebangs)\n"
|
||||
unset warn
|
||||
fi
|
||||
echo " Unversioned shebang replaced by '$shebang': ${f#$PKGDESTDIR}"
|
||||
sed -i "1s@.*python@${shebang}@" -- "$f"
|
||||
|
|
Loading…
Reference in a new issue