mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 05:15:00 +00:00
Omit pythonX.Y segment in stdlib on managed Windows (#4727)
## Summary Windows omits this segment, IIRC. Closes https://github.com/astral-sh/uv/issues/4724.
This commit is contained in:
parent
2c0cb6e021
commit
d05bb45c74
1 changed files with 10 additions and 8 deletions
|
@ -278,14 +278,16 @@ impl InstalledToolchain {
|
|||
/// Ensure the toolchain is marked as externally managed with the
|
||||
/// standard `EXTERNALLY-MANAGED` file.
|
||||
pub fn ensure_externally_managed(&self) -> Result<(), Error> {
|
||||
let lib = if cfg!(windows) { "Lib" } else { "lib" };
|
||||
let file = self
|
||||
.path
|
||||
.join("install")
|
||||
.join(lib)
|
||||
// Note the Python version must not include the patch.
|
||||
.join(format!("python{}", self.key.version().python_version()))
|
||||
.join("EXTERNALLY-MANAGED");
|
||||
// Construct the path to the `stdlib` directory.
|
||||
let stdlib = if cfg!(windows) {
|
||||
self.path.join("install").join("Lib")
|
||||
} else {
|
||||
self.path
|
||||
.join("install")
|
||||
.join("lib")
|
||||
.join(format!("python{}", self.key.version().python_version()))
|
||||
};
|
||||
let file = stdlib.join("EXTERNALLY-MANAGED");
|
||||
fs_err::write(file, EXTERNALLY_MANAGED)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue