include site in pythonpath of wrapped scripts, if python-site is installed

svn path=/nixpkgs/branches/stdenv-updates/; revision=32592
This commit is contained in:
Florian Friesdorf
2012-02-26 17:23:38 +00:00
parent c6893a14df
commit d670c0e45c
3 changed files with 32 additions and 1 deletions

View File

@@ -15,6 +15,14 @@ wrapPythonProgramsIn() {
_addToPythonPath $i
done
program_PYTHONPATH='$(
# activate site if installed
bindir=$(dirname "$0")
pysite="$bindir/pysite"
relpath=$(test -x "$pysite" && "$pysite" path)
echo -n ${relpath:+"$relpath":}
)'"$program_PYTHONPATH"
for i in $(find "$dir" -type f -perm +0100); do
# Rewrite "#! .../env python" to "#! /nix/store/.../python".
@@ -25,7 +33,7 @@ wrapPythonProgramsIn() {
if head -n1 "$i" | grep -q /python; then
echo "wrapping \`$i'..."
wrapProgram "$i" \
--prefix PYTHONPATH ":" $program_PYTHONPATH \
--prefix PYTHONPATH ":" "$program_PYTHONPATH" \
--prefix PATH ":" $program_PATH
fi
done