Skip to content

Commit 92d932e

Browse files
authored
ignore path dev deps in circular deps check (attempt 2) (solana-labs#2578)
* filter out path dev deps in order-crates-for-publishing.py * remove extra backtick * remove debug prints
1 parent cc18a71 commit 92d932e

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

ci/order-crates-for-publishing.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,34 @@ def is_self_dev_dep_with_dev_context_only_utils(package, dependency, wrong_self_
6363

6464
return is_special_cased
6565

66+
67+
# `cargo publish` is fine with circular dev-dependencies if
68+
# they are path deps.
69+
# However, cargo still fails if deps are path deps with versions
70+
# (this when you use `workspace = true`): https://github.com/rust-lang/cargo/issues/4242
71+
# Unlike in is_self_dev_dep_with_dev_context_only_utils(),
72+
# we don't have a clean way of checking if someone used a workspace dev
73+
# dep when they probably meant to use a path dev dep,
74+
# so this function just checks if a dev dep is a path dep
75+
# and provides no special warnings.
76+
def is_path_dev_dep(dependency):
77+
no_explicit_version = '*'
78+
return (
79+
dependency['kind'] == 'dev'
80+
and 'path' in dependency
81+
and dependency['req'] == no_explicit_version
82+
)
83+
6684
def should_add(package, dependency, wrong_self_dev_dependencies):
6785
related_to_solana = dependency['name'].startswith('solana')
6886
self_dev_dep_with_dev_context_only_utils = is_self_dev_dep_with_dev_context_only_utils(
6987
package, dependency, wrong_self_dev_dependencies
7088
)
71-
72-
return related_to_solana and not self_dev_dep_with_dev_context_only_utils
89+
return (
90+
related_to_solana
91+
and not self_dev_dep_with_dev_context_only_utils
92+
and not is_path_dev_dep(dependency)
93+
)
7394

7495
def get_packages():
7596
metadata = load_metadata()

0 commit comments

Comments
 (0)