Commit Graph

3 Commits

Author SHA1 Message Date
Robert Muir
5b2e69ae61 fix ale_python_auto_virtualenv to correctly set virtualenv env vars (#4885)
* fix ale_python_auto_virtualenv to correctly set virtualenv env vars

According to the documentation, `ale_python_auto_virtualenv` should automatically set environment variables for commands, but previously the variables were not set completely or correctly.

Before:
  `PATH` variable was expanded to include `/path/to/venv`
After:
  `PATH` variable is expanded to include `/path/to/venv/bin`
  `VIRTUAL_ENV` variable is set to `path/to/venv`

This mimics exactly what the `activate` scripts do, and allows the configuration knob to work as expected.

For example, after this change, `jedi-language-server` can be installed globally (instead of inside every venv), and it will "just work" (e.g. find references to dependencies in the venv) when editing a file in a project that uses a venv, because the correct variables are set.

* fix test_python_virtualenv.vader test to expect output with both virtualenv vars

* remove unnecessary non-escape in test_python_virtualenv.vader

* fix accidentally removed space in windows test_python_virtualenv.vader
2024-12-29 13:35:28 +09:00
w0rp
bb691d6dee #2172 - Expand PATH in the shell for automatic virtualenv 2023-03-07 01:59:11 +00:00
Bailey Stoner
620ec32da1 Add a test to ensure $VIRTUAL_ENV is respected. 2017-10-11 13:42:38 -07:00