From 08bac7148fb5fd317c0fe0e2596f354700db10a3 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Tue, 13 Aug 2024 22:35:13 +0400 Subject: [PATCH 1/3] filter out path dev deps in order-crates-for-publishing.py --- ci/order-crates-for-publishing.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/ci/order-crates-for-publishing.py b/ci/order-crates-for-publishing.py index 855f0e89d17407..79f9dbf571527e 100755 --- a/ci/order-crates-for-publishing.py +++ b/ci/order-crates-for-publishing.py @@ -63,13 +63,37 @@ def is_self_dev_dep_with_dev_context_only_utils(package, dependency, wrong_self_ return is_special_cased + +# `cargo publish`` is fine with circular dev-dependencies if +# they are path deps. +# However, cargo still fails if deps are path deps with versions +# (this when you use `workspace = true`): https://github.com/rust-lang/cargo/issues/4242 +# Unlike in is_self_dev_dep_with_dev_context_only_utils(), +# we don't have a clean way of checking if someone used a workspace dev +# dep when they probably meant to use a path dev dep, +# so this function just checks if a dev dep is a path dep +# and provides no special warnings. +def is_path_dev_dep(dependency): + no_explicit_version = '*' + return ( + dependency['kind'] == 'dev' + and 'path' in dependency + and dependency['req'] == no_explicit_version + ) + def should_add(package, dependency, wrong_self_dev_dependencies): related_to_solana = dependency['name'].startswith('solana') self_dev_dep_with_dev_context_only_utils = is_self_dev_dep_with_dev_context_only_utils( package, dependency, wrong_self_dev_dependencies ) - - return related_to_solana and not self_dev_dep_with_dev_context_only_utils + if package["name"] == "solana-sanitize": + print(dependency) + print(is_path_dev_dep(dependency)) + return ( + related_to_solana + and not self_dev_dep_with_dev_context_only_utils + and not is_path_dev_dep(dependency) + ) def get_packages(): metadata = load_metadata() From 1d8625bf8f81b4df5a8b7cb8ee3ffc6234a053d7 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Tue, 13 Aug 2024 22:37:49 +0400 Subject: [PATCH 2/3] remove extra backtick --- ci/order-crates-for-publishing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/order-crates-for-publishing.py b/ci/order-crates-for-publishing.py index 79f9dbf571527e..eed596e797445a 100755 --- a/ci/order-crates-for-publishing.py +++ b/ci/order-crates-for-publishing.py @@ -64,7 +64,7 @@ def is_self_dev_dep_with_dev_context_only_utils(package, dependency, wrong_self_ return is_special_cased -# `cargo publish`` is fine with circular dev-dependencies if +# `cargo publish` is fine with circular dev-dependencies if # they are path deps. # However, cargo still fails if deps are path deps with versions # (this when you use `workspace = true`): https://github.com/rust-lang/cargo/issues/4242 From b8337aa9b4ca97b8edeba0be903b26b6197b156d Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Tue, 13 Aug 2024 22:40:49 +0400 Subject: [PATCH 3/3] remove debug prints --- ci/order-crates-for-publishing.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/ci/order-crates-for-publishing.py b/ci/order-crates-for-publishing.py index eed596e797445a..6bfda2b29df0d0 100755 --- a/ci/order-crates-for-publishing.py +++ b/ci/order-crates-for-publishing.py @@ -86,9 +86,6 @@ def should_add(package, dependency, wrong_self_dev_dependencies): self_dev_dep_with_dev_context_only_utils = is_self_dev_dep_with_dev_context_only_utils( package, dependency, wrong_self_dev_dependencies ) - if package["name"] == "solana-sanitize": - print(dependency) - print(is_path_dev_dep(dependency)) return ( related_to_solana and not self_dev_dep_with_dev_context_only_utils