diff --git a/crates/uv-python/src/implementation.rs b/crates/uv-python/src/implementation.rs index 2bb0cec9d..8039fef4c 100644 --- a/crates/uv-python/src/implementation.rs +++ b/crates/uv-python/src/implementation.rs @@ -49,6 +49,7 @@ impl ImplementationName { } } + /// The executable name used in distributions of this implementation. pub fn executable_name(self) -> &'static str { match self { Self::CPython | Self::Pyodide => "python", @@ -56,6 +57,14 @@ impl ImplementationName { } } + /// The name used when installing this implementation as an executable into the bin directory. + pub fn executable_install_name(self) -> &'static str { + match self { + Self::Pyodide => "pyodide", + _ => self.executable_name(), + } + } + pub fn matches_interpreter(self, interpreter: &Interpreter) -> bool { match self { Self::Pyodide => interpreter.os().is_emscripten(), @@ -80,6 +89,13 @@ impl LenientImplementationName { Self::Unknown(name) => name, } } + + pub fn executable_install_name(&self) -> &str { + match self { + Self::Known(implementation) => implementation.executable_install_name(), + Self::Unknown(name) => name, + } + } } impl From<&ImplementationName> for &'static str { diff --git a/crates/uv-python/src/installation.rs b/crates/uv-python/src/installation.rs index 27ca0fd4b..e818d4961 100644 --- a/crates/uv-python/src/installation.rs +++ b/crates/uv-python/src/installation.rs @@ -586,7 +586,7 @@ impl PythonInstallationKey { pub fn executable_name_minor(&self) -> String { format!( "{name}{maj}.{min}{var}{exe}", - name = self.implementation.executable_name(), + name = self.implementation().executable_install_name(), maj = self.major, min = self.minor, var = self.variant.executable_suffix(), @@ -598,7 +598,7 @@ impl PythonInstallationKey { pub fn executable_name_major(&self) -> String { format!( "{name}{maj}{var}{exe}", - name = self.implementation.executable_name(), + name = self.implementation().executable_install_name(), maj = self.major, var = self.variant.executable_suffix(), exe = std::env::consts::EXE_SUFFIX @@ -609,7 +609,7 @@ impl PythonInstallationKey { pub fn executable_name(&self) -> String { format!( "{name}{var}{exe}", - name = self.implementation.executable_name(), + name = self.implementation().executable_install_name(), var = self.variant.executable_suffix(), exe = std::env::consts::EXE_SUFFIX ) diff --git a/crates/uv/tests/it/python_install.rs b/crates/uv/tests/it/python_install.rs index 66d40654e..9fceac5f5 100644 --- a/crates/uv/tests/it/python_install.rs +++ b/crates/uv/tests/it/python_install.rs @@ -3492,12 +3492,12 @@ fn python_install_pyodide() { ----- stderr ----- Installed Python 3.13.2 in [TIME] - + pyodide-3.13.2-emscripten-wasm32-musl (python3.13) + + pyodide-3.13.2-emscripten-wasm32-musl (pyodide3.13) "); let bin_python = context .bin_dir - .child(format!("python3.13{}", std::env::consts::EXE_SUFFIX)); + .child(format!("pyodide3.13{}", std::env::consts::EXE_SUFFIX)); // The executable should be installed in the bin directory bin_python.assert(predicate::path::exists()); @@ -3568,7 +3568,7 @@ fn python_install_pyodide() { ----- stderr ----- Installed Python 3.13.2 in [TIME] - + pyodide-3.13.2-emscripten-wasm32-musl (python3.13) + + pyodide-3.13.2-emscripten-wasm32-musl (pyodide3.13) "); context.python_uninstall().arg("--all").assert().success(); @@ -3581,7 +3581,7 @@ fn python_install_pyodide() { ----- stderr ----- Installed Python 3.13.2 in [TIME] - + pyodide-3.13.2-emscripten-wasm32-musl (python3.13) + + pyodide-3.13.2-emscripten-wasm32-musl (pyodide3.13) "); // Find via `pyodide`` @@ -4266,7 +4266,7 @@ fn python_install_compile_bytecode_pyodide() { ----- stderr ----- Installed Python 3.13.2 in [TIME] - + pyodide-3.13.2-emscripten-wasm32-musl (python3.13) + + pyodide-3.13.2-emscripten-wasm32-musl (pyodide3.13) No compatible versions to bytecode compile (skipped 1) ");