common/hooks: fix python shebang rewrite for multi-versioned packages

This commit is contained in:
Enno Boland 2016-03-27 12:24:00 +02:00
parent 5914ed56f1
commit 6606995831

View file

@ -4,6 +4,12 @@
hook() { hook() {
local pyver= shebang= warn= local pyver= shebang= warn=
case $pkgname in
python-*)
pyver=2.7;;
python3.4-*)
pyver=3.4;;
*)
for i in $python_versions; do for i in $python_versions; do
if [ "$pyver" ]; then if [ "$pyver" ]; then
warn=1 warn=1
@ -11,8 +17,10 @@ hook() {
fi fi
pyver=$i pyver=$i
done done
: ${pyver:=2.7} : ${pyver:=2.7}
;;
esac
shebang="#!/usr/bin/python$pyver" shebang="#!/usr/bin/python$pyver"
find ${PKGDESTDIR} -type f -print0 | \ find ${PKGDESTDIR} -type f -print0 | \
xargs -0 grep -H -b -m 1 "^#!.*\([[:space:]]\|/\)python\([[:space:]]\|$\)" -- | while IFS=: read -r f off _; do xargs -0 grep -H -b -m 1 "^#!.*\([[:space:]]\|/\)python\([[:space:]]\|$\)" -- | while IFS=: read -r f off _; do