Allow selection of pyodide interpreters with "pyodide" (#15256)

This commit is contained in:
Zanie Blue
2025-08-13 14:08:55 -05:00
committed by GitHub
parent 88a7b2d864
commit 2c54d3929c
8 changed files with 243 additions and 93 deletions
+9 -4
View File
@@ -1,3 +1,4 @@
use std::borrow::Cow;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::str::FromStr;
@@ -310,7 +311,7 @@ impl PythonInstallation {
!matches!(
self.implementation(),
LenientImplementationName::Known(ImplementationName::CPython)
)
) || self.os().is_emscripten()
}
/// Return the [`Arch`] of the Python installation as reported by its interpreter.
@@ -394,8 +395,12 @@ impl PythonInstallationKey {
}
}
pub fn implementation(&self) -> &LenientImplementationName {
&self.implementation
pub fn implementation(&self) -> Cow<'_, LenientImplementationName> {
if self.os().is_emscripten() {
Cow::Owned(LenientImplementationName::from(ImplementationName::Pyodide))
} else {
Cow::Borrowed(&self.implementation)
}
}
pub fn version(&self) -> PythonVersion {
@@ -484,7 +489,7 @@ impl fmt::Display for PythonInstallationKey {
write!(
f,
"{}-{}.{}.{}{}{}-{}",
self.implementation,
self.implementation(),
self.major,
self.minor,
self.patch,