Install versioned Python executables into the bin directory during uv python install (#8458)

Updates `uv python install` to link `python3.x` in the executable
directory (i.e., `~/.local/bin`) to the the managed interpreter path.

Includes

- #8569 
- #8571 

Remaining work

- #8663 
- #8650 
- Add an opt-out setting and flag
- Update documentation
This commit is contained in:
Zanie Blue
2024-10-30 09:13:20 -05:00
committed by GitHub
parent 94fc35edd9
commit 4dd36b799f
19 changed files with 597 additions and 89 deletions
+11 -6
View File
@@ -1236,6 +1236,16 @@ impl PythonVariant {
PythonVariant::Freethreaded => interpreter.gil_disabled(),
}
}
/// Return the lib or executable suffix for the variant, e.g., `t` for `python3.13t`.
///
/// Returns an empty string for the default Python variant.
pub fn suffix(self) -> &'static str {
match self {
Self::Default => "",
Self::Freethreaded => "t",
}
}
}
impl PythonRequest {
/// Create a request from a string.
@@ -1635,12 +1645,7 @@ impl std::fmt::Display for ExecutableName {
if let Some(prerelease) = &self.prerelease {
write!(f, "{prerelease}")?;
}
match self.variant {
PythonVariant::Default => {}
PythonVariant::Freethreaded => {
f.write_str("t")?;
}
};
f.write_str(self.variant.suffix())?;
f.write_str(std::env::consts::EXE_SUFFIX)?;
Ok(())
}