mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Add executable_name
This commit is contained in:
parent
eb326f66b5
commit
5a8aa5a3d8
2 changed files with 15 additions and 1 deletions
|
@ -44,6 +44,13 @@ impl ImplementationName {
|
|||
Self::GraalPy => "GraalPy",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn executable_name(self) -> &'static str {
|
||||
match self {
|
||||
Self::CPython => "python",
|
||||
Self::PyPy | Self::GraalPy => self.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl LenientImplementationName {
|
||||
|
@ -53,6 +60,13 @@ impl LenientImplementationName {
|
|||
Self::Unknown(name) => name,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn executable_name(&self) -> &str {
|
||||
match self {
|
||||
Self::Known(implementation) => implementation.executable_name(),
|
||||
Self::Unknown(name) => name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ImplementationName> for &'static str {
|
||||
|
|
|
@ -362,7 +362,7 @@ impl ManagedPythonInstallation {
|
|||
/// If windowed is true, `pythonw.exe` is selected over `python.exe` on windows, with no changes
|
||||
/// on non-windows.
|
||||
pub fn executable(&self, windowed: bool) -> PathBuf {
|
||||
let implementation: &str = self.implementation().into();
|
||||
let implementation = self.implementation().executable_name();
|
||||
|
||||
let version = match self.implementation() {
|
||||
ImplementationName::CPython => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue