Skip to content

Commit fb80d38

Browse files
committed
Also handle dict-syntax for "workspace=true"
1 parent 50602d7 commit fb80d38

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

easybuild/easyblocks/generic/cargo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ def do_replacement(section, workspace_section):
251251
return
252252

253253
for key, value in section.items():
254-
if key.endswith(SUFFIX) and value == 'true':
255-
real_key = key[:-len(SUFFIX)]
254+
if key.endswith(SUFFIX) and value == 'true' or value == '{ workspace = true }':
255+
real_key = key[:-len(SUFFIX)] if key.endswith(SUFFIX) else key
256256
value = workspace_section[real_key]
257257
idx = next(idx for idx, line in enumerate(lines) if key in line)
258258
lines[idx] = f'{real_key} = {value}'

test/easyblocks/easyblock_specific.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def test_cargo_merge_sub_crate(self):
456456
cc.workspace = true
457457
458458
[dev-dependencies]
459-
rand.workspace = true
459+
rand = { workspace = true }
460460
"""))
461461
cargo.merge_sub_crate(cargo_toml, ws_parsed)
462462
self.assertEqual(read_file(cargo_toml).strip(), textwrap.dedent("""

0 commit comments

Comments
 (0)