wrapPython: fix replace of env invokations
This commit is contained in:
parent
ed20bbc8fb
commit
13c04c837d
@ -8,7 +8,6 @@ wrapPythonPrograms() {
|
|||||||
# of dependencies.
|
# of dependencies.
|
||||||
buildPythonPath() {
|
buildPythonPath() {
|
||||||
local pythonPath="$1"
|
local pythonPath="$1"
|
||||||
local python="@executable@"
|
|
||||||
local path
|
local path
|
||||||
|
|
||||||
# Create an empty table of python paths (see doc on _addToPythonPath
|
# Create an empty table of python paths (see doc on _addToPythonPath
|
||||||
@ -51,9 +50,9 @@ wrapPythonProgramsIn() {
|
|||||||
for f in $(find "$dir" -type f -perm -0100); do
|
for f in $(find "$dir" -type f -perm -0100); do
|
||||||
# Rewrite "#! .../env python" to "#! /nix/store/.../python".
|
# Rewrite "#! .../env python" to "#! /nix/store/.../python".
|
||||||
# Strip suffix, like "3" or "2.7m" -- we don't have any choice on which
|
# Strip suffix, like "3" or "2.7m" -- we don't have any choice on which
|
||||||
# Python to use besides one in $python anyway.
|
# Python to use besides one with this hook anyway.
|
||||||
if head -n1 "$f" | grep -q '#!.*/env.*\(python\|pypy\)'; then
|
if head -n1 "$f" | grep -q '#!.*/env.*\(python\|pypy\)'; then
|
||||||
sed -i "$f" -e "1 s^.*/env[ ]*\(python\|pypy\)[^ ]*^#! $python^"
|
sed -i "$f" -e "1 s^.*/env[ ]*\(python\|pypy\)[^ ]*^#! @executable@^"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# catch /python and /.python-wrapped
|
# catch /python and /.python-wrapped
|
||||||
|
Loading…
Reference in New Issue
Block a user