mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
Revert "python-wrapper: fix wrapped argv[0] w/o sed, maybe"
This reverts commit a6dd9bd0cb
.
This commit is contained in:
parent
af4c369d0a
commit
76f4eb5f93
@ -96,10 +96,7 @@ filterExisting() {
|
||||
# Syntax: wrapProgram <PROGRAM> <MAKE-WRAPPER FLAGS...>
|
||||
wrapProgram() {
|
||||
local prog="$1"
|
||||
local progBasename=$(basename $prog)
|
||||
local hiddenDir=$(dirname $prog)/.$progBasename-wrapped-bin
|
||||
local hidden=$hiddenDir/$progBasename
|
||||
mkdir $hiddenDir
|
||||
local hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
|
||||
mv $prog $hidden
|
||||
makeWrapper $hidden $prog "$@"
|
||||
}
|
||||
|
@ -26,6 +26,12 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user