Avoid canonicalizing executables on Windows (#5446)

## Summary

If you have an executable path on a network share path (like
`\\some-host\some-share\...\python.exe`), canonicalizing it adds the
`\\?` prefix, but dunce cannot safely strip it.

This PR changes the Windows logic to avoid canonicalizing altogether. We
don't really expect symlinks on Windows, so it seems unimportant to
resolve them.

Closes: https://github.com/astral-sh/uv/issues/5440.
This commit is contained in:
Charlie Marsh 2024-07-26 08:57:33 -04:00 committed by GitHub
parent 967fcdbb83
commit 8b8f34ac21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 125 deletions

View file

@ -76,7 +76,7 @@ pub(crate) fn create(
interpreter.sys_base_prefix().join("python.exe")
}
} else {
uv_fs::canonicalize_executable(interpreter.sys_executable())?
interpreter.sys_executable().to_path_buf()
}
} else {
unimplemented!("Only Windows and Unix are supported")