Install Pyodide executables as pyodide instead of python (#17760)

Same as #17756 for pyodide
This commit is contained in:
Zanie Blue
2026-01-30 16:43:33 -06:00
parent 4fbe2f162b
commit 3ba3fe355f
3 changed files with 24 additions and 8 deletions
+16
View File
@@ -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 {
+3 -3
View File
@@ -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
)
+5 -5
View File
@@ -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)
");