mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-17 22:07:47 +00:00
Avoid canonicalizing user-provided interpreters (#2072)
## Summary We shouldn't be resolving symlinks on the provided interpreter; otherwise we break `pyenv`, since running `cargo run pip install mypy --python .venv/bin/python` will immediately resolve to (e.g.) `/Users/crmarsh/.pyenv/versions/3.10.2/bin/python3.10`, and pyenv relies on the path to do its lookups. Instead, the canonicalizing happens when we query the interpreter metadata. Closes https://github.com/astral-sh/uv/issues/2068. ## Test Plan Ran `cargo run pip install mypy --python .venv/bin/python -v -n` with a virtualenv created using a pyenv Python; verified that Mypy was installed into the virtual environment, rather than into the global environment.
This commit is contained in:
parent
ef15098288
commit
1f19ef670b
3 changed files with 39 additions and 35 deletions
|
@ -8,6 +8,7 @@ use tracing::{debug, instrument};
|
|||
|
||||
use platform_host::Platform;
|
||||
use uv_cache::Cache;
|
||||
use uv_fs::normalize_path;
|
||||
|
||||
use crate::{Error, Interpreter};
|
||||
|
||||
|
@ -63,7 +64,8 @@ pub fn find_requested_python(
|
|||
Interpreter::query(&executable, platform.clone(), cache).map(Some)
|
||||
} else {
|
||||
// `-p /home/ferris/.local/bin/python3.10`
|
||||
let executable = fs_err::canonicalize(request)?;
|
||||
let executable = normalize_path(request);
|
||||
|
||||
Interpreter::query(&executable, platform.clone(), cache).map(Some)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue