Skip to content

Commit

Permalink
Strip a possible -git suffix from emcc version (#2470)
Browse files Browse the repository at this point in the history
Compare here:
https://github.com/python/cpython/blob/main/configure.ac#L810
which just uses `cut -f1 -d-` to delete everything after the `-`. But
we're only after deleting `-git`.
  • Loading branch information
hoodmane authored Feb 5, 2025
1 parent 2861bf1 commit 031de01
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,10 @@ fn emcc_version() -> Result<String> {
.arg("-dumpversion")
.output()
.context("Failed to run emcc to get the version")?;
Ok(String::from_utf8(emcc.stdout)?.trim().into())
let ver = String::from_utf8(emcc.stdout)?;
let mut trimmed = ver.trim();
trimmed = trimmed.strip_suffix("-git").unwrap_or(trimmed);
Ok(trimmed.into())
}

#[cfg(test)]
Expand Down

0 comments on commit 031de01

Please sign in to comment.