Skip to content

Commit

Permalink
feat: fix if a package name has multiple dashes (#73)
Browse files Browse the repository at this point in the history
Fix if a package name has multiple dashes.
  • Loading branch information
tdejager authored Nov 13, 2023
1 parent b7ea939 commit 3138999
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 10 additions & 1 deletion crates/rattler_installs_packages/src/artifact_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl FromStr for SDistName {

fn from_str(s: &str) -> Result<Self, Self::Err> {
let (package_name, rest) = s
.split_once('-')
.rsplit_once('-')
.ok_or(ParseArtifactNameError::InvalidName)?;

// Determine the package format
Expand Down Expand Up @@ -397,6 +397,15 @@ mod test {
assert_eq!(sn.to_string(), "trio-0.19a0.tar.gz");
}

#[test]
fn test_name_double_dash_from_str() {
let sn: SDistName = "trio-three-0.19a0.tar.gz".parse().unwrap();
assert_eq!(sn.distribution, "trio-three".parse().unwrap());
assert_eq!(sn.version, "0.19a0".parse().unwrap());

assert_eq!(sn.to_string(), "trio-three-0.19a0.tar.gz");
}

#[test]
fn test_many_linux() {
let n: WheelName =
Expand Down
2 changes: 0 additions & 2 deletions crates/rattler_installs_packages/src/tags/from_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ impl WheelTags {

// Ensure that we have a valid success code
if !output.status.success() {
let stdout = String::from_utf8_lossy(&output.stderr);
dbg!(stdout.as_ref());
return Err(FromPythonError::FailedToRun(output.status));
}

Expand Down

0 comments on commit 3138999

Please sign in to comment.