Skip to content

Commit

Permalink
fix: move empty artifact error up (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-arts authored Dec 4, 2023
1 parent ae6e1cb commit 13d8042
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ impl<'db, 'i> PypiDependencyProvider<'db, 'i> {
&self,
artifacts: &'a [ArtifactInfo],
) -> Result<Vec<&'a ArtifactInfo>, &'static str> {
// Filter only artifacts we can work with
if artifacts.is_empty() {
// If there are no wheel artifacts, we're just gonna skip it
return Err("there are no packages available");
}

let mut artifacts = artifacts
.iter()
.filter(|a| a.filename.version().pre.is_none() && a.filename.version().dev.is_none())
Expand All @@ -170,12 +176,6 @@ impl<'db, 'i> PypiDependencyProvider<'db, 'i> {
return Err("prereleases are not allowed");
}

// Filter only artifacts we can work with
if artifacts.is_empty() {
// If there are no wheel artifacts, we're just gonna skip it
return Err("there are no packages available");
}

// Filter yanked artifacts
artifacts.retain(|a| !a.yanked.yanked);
if artifacts.is_empty() {
Expand Down

0 comments on commit 13d8042

Please sign in to comment.