forked from mirrors/nixpkgs
python-linkme-wrapper
This commit is contained in:
parent
d6a18fe4ae
commit
1fa2e7f9a9
|
@ -0,0 +1,13 @@
|
|||
{ stdenv }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "python-linkme-wrapper-1.0";
|
||||
|
||||
unpackPhase = "true";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cat ${./python-linkme-wrapper.sh} > $out/bin/.python-linkme-wrapper
|
||||
chmod +x $out/bin/.python-linkme-wrapper
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Install it into a nix profile and from there build symlink chains.
|
||||
# The chain will be followed to set the PYTHONPATH
|
||||
# A/bin/foo -> B/bin/bar -> NIXENV/bin/.python-linkme-wrapper.sh
|
||||
#
|
||||
|
||||
if test ! -L "$0"; then
|
||||
echo "Link me!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROG=$(basename "$0")
|
||||
SITES=
|
||||
|
||||
pypath() {
|
||||
BIN=$(dirname "$1")
|
||||
BIN=$(realpath -s "$BIN")
|
||||
ENV=$(dirname "$BIN")
|
||||
SITE="$ENV/lib/python2.7/site-packages"
|
||||
SITES="$SITES${SITES:+:}$SITE"
|
||||
|
||||
PRG=$BIN/$(readlink "$1")
|
||||
|
||||
if test -L "$PRG"; then
|
||||
pypath "$PRG"
|
||||
fi
|
||||
}
|
||||
|
||||
pypath $(realpath -s "$0")
|
||||
|
||||
export PYTHONPATH="$PYTHONPATH${PYTHONPATH:+:}$SITES"
|
||||
|
||||
exec $BIN/$PROG "$@"
|
|
@ -2859,6 +2859,8 @@ let
|
|||
|
||||
pythonhomeWrapper = callPackage ../development/interpreters/python/pythonhome-wrapper.nix { };
|
||||
|
||||
pythonLinkmeWrapper = callPackage ../development/interpreters/python/python-linkme-wrapper.nix { };
|
||||
|
||||
pyrex = pyrex095;
|
||||
|
||||
pyrex095 = callPackage ../development/interpreters/pyrex/0.9.5.nix { };
|
||||
|
|
Loading…
Reference in a new issue