From 4a29227cdd136613636158bb0ab652a3be74cd97 Mon Sep 17 00:00:00 2001 From: messense Date: Sun, 18 Sep 2022 18:06:30 +0800 Subject: [PATCH] Fix duplicated `Cargo.toml` of local dependencies in sdist --- Changelog.md | 1 + src/source_distribution.rs | 4 +--- tests/common/other.rs | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 88771b8a6..94a5d320b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fix `Cargo.toml` in new project template in [#1109](https://github.com/PyO3/maturin/pull/1109) * Fix `maturin develop` on Windows when using Python installed from msys2 in [#1112](https://github.com/PyO3/maturin/pull/1112) +* Fix duplicated `Cargo.toml` of local dependencies in sdist in [#1114](https://github.com/PyO3/maturin/pull/1114) ## [0.13.3] - 2022-09-15 diff --git a/src/source_distribution.rs b/src/source_distribution.rs index 962000290..9bcc54e91 100644 --- a/src/source_distribution.rs +++ b/src/source_distribution.rs @@ -179,9 +179,7 @@ fn add_crate_to_source_distribution( .filter(|(target, source)| { // Skip generated files. See https://github.com/rust-lang/cargo/issues/7938#issuecomment-593280660 // and https://github.com/PyO3/maturin/issues/449 - if target == Path::new("Cargo.toml.orig") - || (root_crate && target.file_name() == Some("Cargo.toml".as_ref())) - { + if target == Path::new("Cargo.toml.orig") || target == Path::new("Cargo.toml") { false } else { source.exists() diff --git a/tests/common/other.rs b/tests/common/other.rs index 04f5c6942..396266577 100644 --- a/tests/common/other.rs +++ b/tests/common/other.rs @@ -141,14 +141,17 @@ pub fn test_source_distribution( let tar = GzDecoder::new(tar_gz); let mut archive = Archive::new(tar); let mut files = BTreeSet::new(); + let mut file_count = 0; for entry in archive.entries()? { let entry = entry?; files.insert(format!("{}", entry.path()?.display())); + file_count += 1; } assert_eq!( files, BTreeSet::from_iter(expected_files.into_iter().map(ToString::to_string)) ); + assert_eq!(file_count, files.len(), "duplicated files found in sdist"); Ok(()) }