about summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2011-03-28 17:19:27 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2011-03-28 17:19:27 +0000
commit968496e69bdd4de62fd447f88da2660bd144735f (patch)
treecedaf90c31c41f358235c7207cd72e4f3332d837 /pkgs/development/python-modules
parent7b3bda471d846664c3e7d683c60b3fa0356d3032 (diff)
downloadnixlib-968496e69bdd4de62fd447f88da2660bd144735f.tar
nixlib-968496e69bdd4de62fd447f88da2660bd144735f.tar.gz
nixlib-968496e69bdd4de62fd447f88da2660bd144735f.tar.bz2
nixlib-968496e69bdd4de62fd447f88da2660bd144735f.tar.lz
nixlib-968496e69bdd4de62fd447f88da2660bd144735f.tar.xz
nixlib-968496e69bdd4de62fd447f88da2660bd144735f.tar.zst
nixlib-968496e69bdd4de62fd447f88da2660bd144735f.zip
* wrapPythonPrograms: rewrite the common "#! .../env python" idiom to
  "#! .../python".

svn path=/nixpkgs/branches/modular-python/; revision=26583
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/generic/wrap.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/generic/wrap.sh b/pkgs/development/python-modules/generic/wrap.sh
index 98162c8807f7..fb20c5fd7233 100644
--- a/pkgs/development/python-modules/generic/wrap.sh
+++ b/pkgs/development/python-modules/generic/wrap.sh
@@ -5,6 +5,7 @@ wrapPythonPrograms() {
 wrapPythonProgramsIn() {
     local dir="$1"
     local pythonPath="$2"
+    local python="$(type -p python)"
     local i
 
     declare -A pythonPathsSeen=()
@@ -15,6 +16,12 @@ wrapPythonProgramsIn() {
     done
 
     for i in $(find "$dir" -type f -perm +0100); do
+
+        # Rewrite "#! .../env python" to "#! /nix/store/.../python".
+        if head -n1 "$i" | grep -q '#!.*/env.*python'; then
+            sed -i "$i" -e "1 s^.*/env[ ]*python^#! $python^"
+        fi
+        
         if head -n1 "$i" | grep -q /python; then
             echo "wrapping \`$i'..."
             wrapProgram "$i" \