From 843bf1766899753b953c2be641c74ec3106850a0 Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 31 Jan 2023 16:27:44 +0800 Subject: [PATCH] Keep dev-dependencies in sdist when there are no path dependencies --- src/source_distribution.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/source_distribution.rs b/src/source_distribution.rs index 28acb6b7f..6ecb8639a 100644 --- a/src/source_distribution.rs +++ b/src/source_distribution.rs @@ -67,8 +67,10 @@ fn rewrite_cargo_toml( // ^^^^^^^^^^^^^ dep_name for dep_category in ["dependencies", "dev-dependencies", "build-dependencies"] { if let Some(table) = data.get_mut(dep_category).and_then(|x| x.as_table_mut()) { - if dep_category == "dev-dependencies" { - // Remove dev-dependencies since building from sdist doesn't need them + if dep_category == "dev-dependencies" && !known_path_deps.is_empty() { + // Remove dev-dependencies since building from sdist doesn't need them, + // Keep it when there are no path dependencies to support building from + // sdist with `--locked`/`--frozen`. data.remove(dep_category); rewritten = true; continue;