mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
rustPlatform.importCargoLock: fix [package] section handling
Members of the [package] table in Cargo.toml can be either subtables, or values like strings and bools. Python is happy to check for membership of "workspace" in a string, since Python strings are iterables, but if the value is a bool, Python will throw an exception.
This commit is contained in:
parent
d7fa40f31e
commit
38fb742663
5 changed files with 21 additions and 3 deletions
|
@ -108,7 +108,7 @@ let
|
||||||
|
|
||||||
# Replaces values inherited by workspace members.
|
# Replaces values inherited by workspace members.
|
||||||
replaceWorkspaceValues = writers.writePython3 "replace-workspace-values"
|
replaceWorkspaceValues = writers.writePython3 "replace-workspace-values"
|
||||||
{ libraries = with python3Packages; [ tomli tomli-w ]; flakeIgnore = [ "E501" ]; }
|
{ libraries = with python3Packages; [ tomli tomli-w ]; flakeIgnore = [ "E501" "W503" ]; }
|
||||||
(builtins.readFile ./replace-workspace-values.py);
|
(builtins.readFile ./replace-workspace-values.py);
|
||||||
|
|
||||||
# Fetch and unpack a crate.
|
# Fetch and unpack a crate.
|
||||||
|
|
|
@ -18,7 +18,11 @@ def load_file(path: str) -> dict[str, Any]:
|
||||||
def replace_key(
|
def replace_key(
|
||||||
workspace_manifest: dict[str, Any], table: dict[str, Any], section: str, key: str
|
workspace_manifest: dict[str, Any], table: dict[str, Any], section: str, key: str
|
||||||
) -> bool:
|
) -> bool:
|
||||||
if "workspace" in table[key] and table[key]["workspace"] is True:
|
if (
|
||||||
|
isinstance(table[key], dict)
|
||||||
|
and "workspace" in table[key]
|
||||||
|
and table[key]["workspace"] is True
|
||||||
|
):
|
||||||
print("replacing " + key)
|
print("replacing " + key)
|
||||||
|
|
||||||
replaced = table[key]
|
replaced = table[key]
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
v1 = callPackage ./v1 { };
|
v1 = callPackage ./v1 { };
|
||||||
gitDependencyWorkspaceInheritance = callPackage ./git-dependency-workspace-inheritance {
|
gitDependencyWorkspaceInheritance = callPackage ./git-dependency-workspace-inheritance {
|
||||||
replaceWorkspaceValues = writers.writePython3 "replace-workspace-values"
|
replaceWorkspaceValues = writers.writePython3 "replace-workspace-values"
|
||||||
{ libraries = with python3Packages; [ tomli tomli-w ]; flakeIgnore = [ "E501" ]; }
|
{ libraries = with python3Packages; [ tomli tomli-w ]; flakeIgnore = [ "E501" "W503" ]; }
|
||||||
(builtins.readFile ../../replace-workspace-values.py);
|
(builtins.readFile ../../replace-workspace-values.py);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
[package]
|
[package]
|
||||||
|
name = "im_using_workspaces"
|
||||||
version = { workspace = true }
|
version = { workspace = true }
|
||||||
|
publish = false
|
||||||
|
keywords = [
|
||||||
|
"workspace",
|
||||||
|
"other_thing",
|
||||||
|
"third_thing",
|
||||||
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
foo = { workspace = true, features = ["cat"] }
|
foo = { workspace = true, features = ["cat"] }
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
[package]
|
[package]
|
||||||
|
name = "im_using_workspaces"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
publish = false
|
||||||
|
keywords = [
|
||||||
|
"workspace",
|
||||||
|
"other_thing",
|
||||||
|
"third_thing",
|
||||||
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bar = "1.0.0"
|
bar = "1.0.0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue