uv/crates/uv-virtualenv/src/activator
Pavel Dikov cb47aed9de
feat(venv): add relocatable flag (#5515)
## Summary

Adds a `--relocatable` CLI arg to `uv venv`. This flag does two things:

* ensures that the associated activation scripts do not rely on a
hardcoded
absolute path to the virtual environment (to the extent possible; `.csh`
and
  `.nu` left as-is)
* persists a `relocatable` flag in `pyvenv.cfg`.

The flag in `pyvenv.cfg` in turn instructs the wheel `Installer` to
create script
entrypoints in a relocatable way (use `exec` trick + `dirname $0` on
POSIX;
use relative path to `python[w].exe` on Windows).

Fixes: #3863

## Test Plan

* Relocatable console scripts covered as additional scenarios in
existing test cases.
* Integration testing of boilerplate generation in `venv`.
* Manual testing of `uv venv` with and without `--relocatable`
2024-07-29 00:10:11 +00:00
..
.gitattributes Rename `gourgeist` to `uv-virtualenv` (#2118) 2024-03-01 14:02:40 -05:00
activate Rename `gourgeist` to `uv-virtualenv` (#2118) 2024-03-01 14:02:40 -05:00
activate.bat feat(venv): add relocatable flag (#5515) 2024-07-29 00:10:11 +00:00
activate.csh Rename `gourgeist` to `uv-virtualenv` (#2118) 2024-03-01 14:02:40 -05:00
activate.fish Update activation scripts from virtualenv (#3376) 2024-05-04 23:30:00 +00:00
activate.nu Rename `gourgeist` to `uv-virtualenv` (#2118) 2024-03-01 14:02:40 -05:00
activate.ps1 Update activation scripts from virtualenv (#3376) 2024-05-04 23:30:00 +00:00
activate_this.py Update activate_this.py to use runpy instead of exec in the docstring (#3442) 2024-05-13 01:21:24 +00:00
deactivate.bat Rename `gourgeist` to `uv-virtualenv` (#2118) 2024-03-01 14:02:40 -05:00
pydoc.bat Rename `gourgeist` to `uv-virtualenv` (#2118) 2024-03-01 14:02:40 -05:00