mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
replace-workspace-values.py: Allow "package" key in Cargo.toml dependencies (#377721)
* Allow "package" key in Cargo.toml dependencies * Update replace-workspace-values.py Some dependencies in Cargo.toml have a "package" key, which serves as an alias: ``` foo = { package = "original-name" ... } ``` which with nixpkgs triggered ``` > Copying to /nix/store/jay72vz43afnlymsah7v543zmnv6l7ck-gcli-0.3.0-vendor/subxt-0.37.0 > Patching /nix/store/jay72vz43afnlymsah7v543zmnv6l7ck-gcli-0.3.0-vendor/subxt-0.37.0/Cargo.toml > Traceback (most recent call last): > File "/nix/store/harh7nnnib9896dwqr0xjqrr0l8wdcw7-replace-workspace-values/bin/replace-workspace-values", line 127, in <module> > main() > File "/nix/store/harh7nnnib9896dwqr0xjqrr0l8wdcw7-replace-workspace-values/bin/replace-workspace-values", line 104, in main > changed |= replace_dependencies(workspace_manifest, crate_manifest) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/nix/store/harh7nnnib9896dwqr0xjqrr0l8wdcw7-replace-workspace-values/bin/replace-workspace-values", line 77, in replace_dependencies > changed |= replace_key(workspace_manifest, root[key], "dependencies", k) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/nix/store/harh7nnnib9896dwqr0xjqrr0l8wdcw7-replace-workspace-values/bin/replace-workspace-values", line 58, in replace_key > raise Exception(f"Unhandled keys in inherited dependency {key}: {local_dep}") > Exception: Unhandled keys in inherited dependency codec: {'package': 'parity-scale-codec'} > Traceback (most recent call last): > File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 314, in <module> > main() > File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 310, in main > subcommand_func() > File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 302, in <lambda> > "create-vendor": lambda: create_vendor(vendor_staging_dir=Path(sys.argv[2]), out_dir=Path(sys.argv[3])) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 259, in create_vendor > copy_and_patch_git_crate_subtree(git_tree, pkg["name"], crate_out_dir) > File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 215, in copy_and_patch_git_crate_subtree > subprocess.check_output(cmd) > File "/nix/store/qrc496n6fsqp4p5m5h8wmw5d5jwyw5mr-python3-3.12.8/lib/python3.12/subprocess.py", line 466, in check_output > return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/nix/store/qrc496n6fsqp4p5m5h8wmw5d5jwyw5mr-python3-3.12.8/lib/python3.12/subprocess.py", line 571, in run > raise CalledProcessError(retcode, process.args, > subprocess.CalledProcessError: Command '['replace-workspace-values', '/nix/store/jay72vz43afnlymsah7v543zmnv6l7ck-gcli-0.3.0-vendor/subxt-0.37.0/Cargo.toml', '/nix/store/c4jdggg9ihgi032pyc7g6ysdpb30xv1r-gcli-0.3.0-vendor-staging/git/00f181c1a5d8986e7146ddc72a745c793a9a1d8e/Cargo.toml']' returned non-zero exit status 1. ``` This fixes that
This commit is contained in:
parent
e4f64235e4
commit
52887dda76
1 changed files with 3 additions and 0 deletions
|
@ -53,6 +53,9 @@ def replace_key(
|
|||
if optional:
|
||||
final["optional"] = True
|
||||
|
||||
if "package" in local_dep:
|
||||
final["package"] = local_dep.pop("package")
|
||||
|
||||
if local_dep:
|
||||
raise Exception(f"Unhandled keys in inherited dependency {key}: {local_dep}")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue