13 buildPythonPackage rec {
14 pname = "virtualenvwrapper";
16 format = "setuptools";
19 inherit pname version;
20 sha256 = "sha256-1Ge+rFpEvgD7XNG88zI5jD2rX7O9OveBXqhrTWuz06Q=";
23 # pip depend on $HOME setting
24 preConfigure = "export HOME=$TMPDIR";
26 buildInputs = [ pbr pip pkgs.which ];
27 propagatedBuildInputs = [ stevedore virtualenv virtualenv-clone ];
30 for file in "virtualenvwrapper.sh" "virtualenvwrapper_lazy.sh"; do
31 substituteInPlace "$file" --replace "which" "${pkgs.which}/bin/which"
33 # We can't set PYTHONPATH in a normal way (like exporting in a wrapper
34 # script) because the user has to evaluate the script and we don't want
35 # modify the global PYTHONPATH which would affect the user's
37 # Furthermore it isn't possible to just use VIRTUALENVWRAPPER_PYTHON
38 # for this workaround, because this variable is well quoted inside the
40 # (the trailing " -" is required to only replace things like these one:
41 # "$VIRTUALENVWRAPPER_PYTHON" -c "import os,[...] and not in
42 # if-statements or anything like that.
43 # ...and yes, this "patch" is hacky :)
44 substituteInPlace "$file" --replace '"$VIRTUALENVWRAPPER_PYTHON" -' 'env PYTHONPATH="$VIRTUALENVWRAPPER_PYTHONPATH" "$VIRTUALENVWRAPPER_PYTHON" -'
49 # This might look like a dirty hack but we can't use the makeWrapper function because
50 # the wrapped file were then called via "exec". The virtualenvwrapper shell scripts
51 # aren't normal executables. Instead, the user has to evaluate them.
53 for file in "virtualenvwrapper.sh" "virtualenvwrapper_lazy.sh"; do
54 local wrapper="$out/bin/$file"
55 local wrapped="$out/bin/.$file-wrapped"
56 mv "$wrapper" "$wrapped"
58 # WARNING: Don't indent the lines below because that would break EOF
59 cat > "$wrapper" << EOF
60 export PATH="${python}/bin:\$PATH"
61 export VIRTUALENVWRAPPER_PYTHONPATH="$PYTHONPATH:$(toPythonPath $out)"
71 description = "Enhancements to virtualenv";
72 homepage = "https://pypi.python.org/pypi/virtualenvwrapper";
73 license = licenses.mit;