-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add Pyodide support #12731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Pyodide support #12731
Changes from all commits
122703e
8342b02
6537e2f
6302a6e
cefb169
f35d54c
af7a8e2
b7ea789
315f03e
92d4de4
9528f9f
26b2983
4e0218c
08aa62d
f5c6b05
9c29572
364c659
e45f18e
2774ed4
f4db3b8
e9e37be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,8 @@ pub enum PlatformTag { | |
| Illumos { release_arch: SmallString }, | ||
| /// Ex) `solaris_11_4_x86_64` | ||
| Solaris { release_arch: SmallString }, | ||
| /// Ex) `pyodide_2024_0_wasm32` | ||
| Pyodide { major: u16, minor: u16 }, | ||
| } | ||
|
|
||
| impl PlatformTag { | ||
|
|
@@ -97,6 +99,7 @@ impl PlatformTag { | |
| PlatformTag::Haiku { .. } => Some("Haiku"), | ||
| PlatformTag::Illumos { .. } => Some("Illumos"), | ||
| PlatformTag::Solaris { .. } => Some("Solaris"), | ||
| PlatformTag::Pyodide { .. } => Some("Pyodide"), | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -262,6 +265,7 @@ impl std::fmt::Display for PlatformTag { | |
| Self::Haiku { release_arch } => write!(f, "haiku_{release_arch}"), | ||
| Self::Illumos { release_arch } => write!(f, "illumos_{release_arch}"), | ||
| Self::Solaris { release_arch } => write!(f, "solaris_{release_arch}_64bit"), | ||
| Self::Pyodide { major, minor } => write!(f, "pyodide_{major}_{minor}_wasm32"), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hoodmane -- Should this not be
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put up a PR here, I may be mistaken though: #14226
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah okay, I'm seeing that the wheels in |
||
| } | ||
| } | ||
| } | ||
|
|
@@ -616,6 +620,35 @@ impl FromStr for PlatformTag { | |
| }); | ||
| } | ||
|
|
||
| if let Some(rest) = s.strip_prefix("pyodide_") { | ||
| let mid = | ||
| rest.strip_suffix("_wasm32") | ||
| .ok_or_else(|| ParsePlatformTagError::InvalidArch { | ||
| platform: "pyodide", | ||
| tag: s.to_string(), | ||
| })?; | ||
| let underscore = memchr::memchr(b'_', mid.as_bytes()).ok_or_else(|| { | ||
| ParsePlatformTagError::InvalidFormat { | ||
| platform: "pyodide", | ||
| tag: s.to_string(), | ||
| } | ||
| })?; | ||
| let major: u16 = mid[..underscore].parse().map_err(|_| { | ||
| ParsePlatformTagError::InvalidMajorVersion { | ||
| platform: "pyodide", | ||
| tag: s.to_string(), | ||
| } | ||
| })?; | ||
|
|
||
| let minor: u16 = mid[underscore + 1..].parse().map_err(|_| { | ||
| ParsePlatformTagError::InvalidMinorVersion { | ||
| platform: "pyodide", | ||
| tag: s.to_string(), | ||
| } | ||
| })?; | ||
| return Ok(Self::Pyodide { major, minor }); | ||
| } | ||
|
|
||
| Err(ParsePlatformTagError::UnknownFormat(s.to_string())) | ||
| } | ||
| } | ||
|
|
@@ -900,6 +933,27 @@ mod tests { | |
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn pyodide_platform() { | ||
| let tag = PlatformTag::Pyodide { | ||
| major: 2024, | ||
| minor: 0, | ||
| }; | ||
| assert_eq!( | ||
| PlatformTag::from_str("pyodide_2024_0_wasm32").as_ref(), | ||
| Ok(&tag) | ||
| ); | ||
| assert_eq!(tag.to_string(), "pyodide_2024_0_wasm32"); | ||
|
|
||
| assert_eq!( | ||
| PlatformTag::from_str("pyodide_2024_0_wasm64"), | ||
| Err(ParsePlatformTagError::InvalidArch { | ||
| platform: "pyodide", | ||
| tag: "pyodide_2024_0_wasm64".to_string() | ||
| }) | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn unknown_platform() { | ||
| assert_eq!( | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.