Refactoring
This commit is contained in:
parent
67820820a6
commit
efbb5de1c5
|
@ -8168,14 +8168,26 @@ rec {
|
||||||
patchPhase = ''
|
patchPhase = ''
|
||||||
substituteInPlace "virtualenvwrapper.sh" --replace "which" "${pkgs.which}/bin/which"
|
substituteInPlace "virtualenvwrapper.sh" --replace "which" "${pkgs.which}/bin/which"
|
||||||
substituteInPlace "virtualenvwrapper_lazy.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
|
# 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
|
# the wrapped file were then called via "exec". The virtualenvwrapper shell scripts
|
||||||
# aren't normal executables. Instead, the user has to evaluate them.
|
# aren't normal executables. Instead, the user has to evaluate them.
|
||||||
|
|
||||||
for file in "virtualenvwrapper.sh" "virtualenvwrapper_lazy.sh"; do
|
for file in "virtualenvwrapper.sh" "virtualenvwrapper_lazy.sh"; do
|
||||||
# Insert the required PATH & PYTHONPATH variables right on the top
|
local wrapper="$out/bin/$file"
|
||||||
sed -i "2iexport PATH=$PATH:\$PATH" "$file"
|
local wrapped="$out/bin/.$file-wrapped"
|
||||||
sed -i "3iexport PYTHONPATH=$PYTHONPATH:$(toPythonPath $out):\$PYTHONPATH" "$file"
|
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
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue