From 6606995831a0e1ef40cd9f68a1d02f38ec4dd524 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Sun, 27 Mar 2016 12:24:00 +0200 Subject: [PATCH] common/hooks: fix python shebang rewrite for multi-versioned packages --- .../03-rewrite-python-shebang.sh} | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) rename common/hooks/{post-install/07-rewrite-python-shebang.sh => pre-pkg/03-rewrite-python-shebang.sh} (75%) diff --git a/common/hooks/post-install/07-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh similarity index 75% rename from common/hooks/post-install/07-rewrite-python-shebang.sh rename to common/hooks/pre-pkg/03-rewrite-python-shebang.sh index 8030e68035f..cdd608f4b46 100644 --- a/common/hooks/post-install/07-rewrite-python-shebang.sh +++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh @@ -4,15 +4,23 @@ hook() { local pyver= shebang= warn= - for i in $python_versions; do - if [ "$pyver" ]; then - warn=1 - break; - fi - pyver=$i - done + case $pkgname in + python-*) + pyver=2.7;; + python3.4-*) + pyver=3.4;; + *) + for i in $python_versions; do + if [ "$pyver" ]; then + warn=1 + break; + fi + pyver=$i + done + : ${pyver:=2.7} + ;; + esac - : ${pyver:=2.7} 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