mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
rustPlatform.importCargoLock: handle workspace Cargo.toml false positives
Since we grep for 'workspace', it's possible the script ends up running on a Cargo.toml that has the word 'workspace' in a comment, but does not actually use workspaces
This commit is contained in:
parent
6085b3b7f7
commit
c86b1a0bca
1 changed files with 9 additions and 1 deletions
|
@ -63,8 +63,16 @@ def replace_dependencies(
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
top_cargo_toml = load_file(sys.argv[2])
|
||||||
|
|
||||||
|
if "workspace" not in top_cargo_toml:
|
||||||
|
# If top_cargo_toml is not a workspace manifest, then this script was probably
|
||||||
|
# ran on something that does not actually use workspace dependencies
|
||||||
|
print(f"{sys.argv[2]} is not a workspace manifest, doing nothing.")
|
||||||
|
return
|
||||||
|
|
||||||
crate_manifest = load_file(sys.argv[1])
|
crate_manifest = load_file(sys.argv[1])
|
||||||
workspace_manifest = load_file(sys.argv[2])["workspace"]
|
workspace_manifest = top_cargo_toml["workspace"]
|
||||||
|
|
||||||
if "workspace" in crate_manifest:
|
if "workspace" in crate_manifest:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue