From b0df57bf800f5677981f8d85e5e7aa092046d630 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Wed, 16 Oct 2024 15:44:05 +0400 Subject: [PATCH] fix: correctly handle b as pre-release in Vyper version (#213) Closes https://github.com/foundry-rs/foundry/issues/9123 I've done similar workaround for rc before. For semver we need those to be prepended by a dash. PEP440 pragmas are still might not be parsed correctly but this is not a showstopper as we're just ignoring them right now, and user would see a vyper error in case of mismatch. --- crates/compilers/src/compilers/vyper/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/compilers/src/compilers/vyper/mod.rs b/crates/compilers/src/compilers/vyper/mod.rs index fa64c3ed..1b351124 100644 --- a/crates/compilers/src/compilers/vyper/mod.rs +++ b/crates/compilers/src/compilers/vyper/mod.rs @@ -177,7 +177,9 @@ impl Vyper { trace!(?output); if output.status.success() { let stdout = String::from_utf8_lossy(&output.stdout); - Ok(Version::from_str(&stdout.trim().replace("rc", "-rc"))?) + Ok(Version::from_str( + &stdout.trim().replace("rc", "-rc").replace("b", "-b").replace("a", "-a"), + )?) } else { Err(SolcError::solc_output(&output)) }