about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/python-modules/generic/wrap.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/generic/wrap.sh b/pkgs/development/python-modules/generic/wrap.sh
index dda9f4877f67..f81adf0bae93 100644
--- a/pkgs/development/python-modules/generic/wrap.sh
+++ b/pkgs/development/python-modules/generic/wrap.sh
@@ -26,7 +26,9 @@ 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" -e "/^#\!/a import sys; sys.argv[0] = '$(basename $i)'"
+                sed -i "$i" -e '1,/#!/ { /^#\!/,/^[^#]/ {
+                    /^[^#]/i import sys; sys.argv[0] = '"'$(basename "$i")'"'
+                }}'
                 wrapProgram "$i" \
                     --prefix PYTHONPATH ":" $program_PYTHONPATH \
                     --prefix PATH ":" $program_PATH