mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Use same-file
to detect interpreter shims (#1099)
Our existing detection doesn't work on Windows, because we canoncalize the interpreter path but not `info.sys_executable`, so the former includes the UNC prefix, etc. This is cross-platform and gets at the intent of the check.
This commit is contained in:
parent
f4939e50a6
commit
5ad2e60561
4 changed files with 4 additions and 1 deletions
|
@ -25,6 +25,7 @@ fs-err = { workspace = true, features = ["tokio"] }
|
|||
once_cell = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
rmp-serde = { workspace = true }
|
||||
same-file = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
|
|
@ -392,7 +392,7 @@ impl InterpreterQueryResult {
|
|||
|
||||
// If `executable` is a pyenv shim, a bash script that redirects to the activated
|
||||
// python executable at another path, we're not allowed to cache the interpreter info.
|
||||
if executable == info.sys_executable {
|
||||
if same_file::is_same_file(executable, &info.sys_executable).unwrap_or(false) {
|
||||
fs::create_dir_all(cache_entry.dir())?;
|
||||
write_atomic_sync(
|
||||
cache_entry.path(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue