Refactoring
This commit is contained in:
parent
67820820a6
commit
efbb5de1c5
1 changed files with 15 additions and 3 deletions
|
@ -8168,14 +8168,26 @@ rec {
|
|||
patchPhase = ''
|
||||
substituteInPlace "virtualenvwrapper.sh" --replace "which" "${pkgs.which}/bin/which"
|
||||
substituteInPlace "virtualenvwrapper_lazy.sh" --replace "which" "${pkgs.which}/bin/which"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
# This might look like a dirty hack but we can't use the makeWrapper function because
|
||||
# the wrapped file were then called via "exec". The virtualenvwrapper shell scripts
|
||||
# aren't normal executables. Instead, the user has to evaluate them.
|
||||
|
||||
for file in "virtualenvwrapper.sh" "virtualenvwrapper_lazy.sh"; do
|
||||
# Insert the required PATH & PYTHONPATH variables right on the top
|
||||
sed -i "2iexport PATH=$PATH:\$PATH" "$file"
|
||||
sed -i "3iexport PYTHONPATH=$PYTHONPATH:$(toPythonPath $out):\$PYTHONPATH" "$file"
|
||||
local wrapper="$out/bin/$file"
|
||||
local wrapped="$out/bin/.$file-wrapped"
|
||||
mv "$wrapper" "$wrapped"
|
||||
|
||||
cat > "$wrapper" <<- EOF
|
||||
export PATH=$PATH:\$PATH
|
||||
export PYTHONPATH=$PYTHONPATH:$(toPythonPath $out):\$PYTHONPATH
|
||||
source "$wrapped"
|
||||
EOF
|
||||
|
||||
chmod -x "$wrapped"
|
||||
chmod +x "$wrapper"
|
||||
done
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue