python-wrapper: fix wrapped argv[0] w/o sed, maybe

This commit is contained in:
tv@shackspace.de 2014-07-30 19:44:21 +02:00 committed by Michael Raskin
parent f87c516a91
commit a6dd9bd0cb
2 changed files with 4 additions and 7 deletions

View file

@ -96,7 +96,10 @@ filterExisting() {
# Syntax: wrapProgram <PROGRAM> <MAKE-WRAPPER FLAGS...>
wrapProgram() {
local prog="$1"
local hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
local progBasename=$(basename $prog)
local hiddenDir=$(dirname $prog)/.$progBasename-wrapped-bin
local hidden=$hiddenDir/$progBasename
mkdir $hiddenDir
mv $prog $hidden
makeWrapper $hidden $prog "$@"
}

View file

@ -26,12 +26,6 @@ wrapPythonProgramsIn() {
# dont wrap EGG-INFO scripts since they are called from python
if echo "$i" | grep -v EGG-INFO/scripts; then
echo "wrapping \`$i'..."
sed -i "$i" -re '1 {
/^#!/!b; :r
/\\$/{N;b r}
/__future__|^ *(#.*)?$/{n;b r}
/^ *[^# ]/i import sys; sys.argv[0] = '"'$(basename "$i")'"'
}'
wrapProgram "$i" \
--prefix PYTHONPATH ":" $program_PYTHONPATH \
--prefix PATH ":" $program_PATH