Skip to content

Commit 3ba3fe3

Browse files
committed
Install Pyodide executables as pyodide instead of python (#17760)
Same as #17756 for pyodide
1 parent 4fbe2f1 commit 3ba3fe3

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

crates/uv-python/src/implementation.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,22 @@ impl ImplementationName {
4949
}
5050
}
5151

52+
/// The executable name used in distributions of this implementation.
5253
pub fn executable_name(self) -> &'static str {
5354
match self {
5455
Self::CPython | Self::Pyodide => "python",
5556
Self::PyPy | Self::GraalPy => self.into(),
5657
}
5758
}
5859

60+
/// The name used when installing this implementation as an executable into the bin directory.
61+
pub fn executable_install_name(self) -> &'static str {
62+
match self {
63+
Self::Pyodide => "pyodide",
64+
_ => self.executable_name(),
65+
}
66+
}
67+
5968
pub fn matches_interpreter(self, interpreter: &Interpreter) -> bool {
6069
match self {
6170
Self::Pyodide => interpreter.os().is_emscripten(),
@@ -80,6 +89,13 @@ impl LenientImplementationName {
8089
Self::Unknown(name) => name,
8190
}
8291
}
92+
93+
pub fn executable_install_name(&self) -> &str {
94+
match self {
95+
Self::Known(implementation) => implementation.executable_install_name(),
96+
Self::Unknown(name) => name,
97+
}
98+
}
8399
}
84100

85101
impl From<&ImplementationName> for &'static str {

crates/uv-python/src/installation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ impl PythonInstallationKey {
586586
pub fn executable_name_minor(&self) -> String {
587587
format!(
588588
"{name}{maj}.{min}{var}{exe}",
589-
name = self.implementation.executable_name(),
589+
name = self.implementation().executable_install_name(),
590590
maj = self.major,
591591
min = self.minor,
592592
var = self.variant.executable_suffix(),
@@ -598,7 +598,7 @@ impl PythonInstallationKey {
598598
pub fn executable_name_major(&self) -> String {
599599
format!(
600600
"{name}{maj}{var}{exe}",
601-
name = self.implementation.executable_name(),
601+
name = self.implementation().executable_install_name(),
602602
maj = self.major,
603603
var = self.variant.executable_suffix(),
604604
exe = std::env::consts::EXE_SUFFIX
@@ -609,7 +609,7 @@ impl PythonInstallationKey {
609609
pub fn executable_name(&self) -> String {
610610
format!(
611611
"{name}{var}{exe}",
612-
name = self.implementation.executable_name(),
612+
name = self.implementation().executable_install_name(),
613613
var = self.variant.executable_suffix(),
614614
exe = std::env::consts::EXE_SUFFIX
615615
)

crates/uv/tests/it/python_install.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3492,12 +3492,12 @@ fn python_install_pyodide() {
34923492
34933493
----- stderr -----
34943494
Installed Python 3.13.2 in [TIME]
3495-
+ pyodide-3.13.2-emscripten-wasm32-musl (python3.13)
3495+
+ pyodide-3.13.2-emscripten-wasm32-musl (pyodide3.13)
34963496
");
34973497

34983498
let bin_python = context
34993499
.bin_dir
3500-
.child(format!("python3.13{}", std::env::consts::EXE_SUFFIX));
3500+
.child(format!("pyodide3.13{}", std::env::consts::EXE_SUFFIX));
35013501

35023502
// The executable should be installed in the bin directory
35033503
bin_python.assert(predicate::path::exists());
@@ -3568,7 +3568,7 @@ fn python_install_pyodide() {
35683568
35693569
----- stderr -----
35703570
Installed Python 3.13.2 in [TIME]
3571-
+ pyodide-3.13.2-emscripten-wasm32-musl (python3.13)
3571+
+ pyodide-3.13.2-emscripten-wasm32-musl (pyodide3.13)
35723572
");
35733573

35743574
context.python_uninstall().arg("--all").assert().success();
@@ -3581,7 +3581,7 @@ fn python_install_pyodide() {
35813581
35823582
----- stderr -----
35833583
Installed Python 3.13.2 in [TIME]
3584-
+ pyodide-3.13.2-emscripten-wasm32-musl (python3.13)
3584+
+ pyodide-3.13.2-emscripten-wasm32-musl (pyodide3.13)
35853585
");
35863586

35873587
// Find via `pyodide``
@@ -4266,7 +4266,7 @@ fn python_install_compile_bytecode_pyodide() {
42664266
42674267
----- stderr -----
42684268
Installed Python 3.13.2 in [TIME]
4269-
+ pyodide-3.13.2-emscripten-wasm32-musl (python3.13)
4269+
+ pyodide-3.13.2-emscripten-wasm32-musl (pyodide3.13)
42704270
No compatible versions to bytecode compile (skipped 1)
42714271
");
42724272

0 commit comments

Comments
 (0)