mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-15 01:05:01 +00:00
Ensure python
-to-pythonX.Y
symlink exists in downloaded Pythons (#5849)
## Summary After installing: ``` ❯ readlink "/Users/crmarsh/Library/Application Support/uv/python/cpython-3.12.4-macos-aarch64-none/bin/python" python3.12 ❯ readlink "/Users/crmarsh/Library/Application Support/uv/python/cpython-3.9.5-macos-aarch64-none/bin/python" python3.9 ``` Closes https://github.com/astral-sh/uv/issues/5838.
This commit is contained in:
parent
e58c503f65
commit
d0b16f9018
1 changed files with 15 additions and 0 deletions
|
@ -495,6 +495,21 @@ impl ManagedPythonDownload {
|
|||
extracted = extracted.join("install");
|
||||
}
|
||||
|
||||
// If the distribution is missing a `python`-to-`pythonX.Y` symlink, add it. PEP 394 permits
|
||||
// it, and python-build-standalone releases after `20240726` include it, but releases prior
|
||||
// to that date do not.
|
||||
#[cfg(unix)]
|
||||
{
|
||||
match std::os::unix::fs::symlink(
|
||||
format!("python{}.{}", self.key.major, self.key.minor),
|
||||
extracted.join("bin").join("python"),
|
||||
) {
|
||||
Ok(()) => {}
|
||||
Err(err) if err.kind() == io::ErrorKind::AlreadyExists => {}
|
||||
Err(err) => return Err(err.into()),
|
||||
}
|
||||
}
|
||||
|
||||
// Persist it to the target
|
||||
debug!("Moving {} to {}", extracted.display(), path.user_display());
|
||||
rename_with_retry(extracted, &path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue