From da3f500d82efa7ef548930b1aa6e09f3fbb4c8be Mon Sep 17 00:00:00 2001 From: messense Date: Fri, 11 Aug 2023 22:29:39 +0800 Subject: [PATCH] Handle renamed Rust dependency in sdist --- src/source_distribution.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/source_distribution.rs b/src/source_distribution.rs index 709899f98..ea6162a8f 100644 --- a/src/source_distribution.rs +++ b/src/source_distribution.rs @@ -546,21 +546,19 @@ fn find_path_deps(cargo_metadata: &Metadata) -> Result> while let Some(top) = stack.pop() { for dependency in &top.dependencies { if let Some(path) = &dependency.path { + let dep_name = dependency.rename.as_ref().unwrap_or(&dependency.name); if matches!(dependency.kind, cargo_metadata::DependencyKind::Development) { // Skip dev-only dependency debug!( "Skipping development only dependency {} ({})", - dependency.name, path + dep_name, path ); continue; } // we search for the respective package by `manifest_path`, there seems // to be no way to query the dependency graph given `dependency` let dep_manifest_path = path.join("Cargo.toml"); - path_deps.insert( - dependency.name.clone(), - PathBuf::from(dep_manifest_path.clone()), - ); + path_deps.insert(dep_name.clone(), PathBuf::from(dep_manifest_path.clone())); if let Some(dep_package) = cargo_metadata .packages .iter()