Skip to content

Commit 1b36e9d

Browse files
cyliangtwPatater
authored andcommitted
config: Support targets with sector attributes
Fixes #182
1 parent 4e978ce commit 1b36e9d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

news/182.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support compilation of targets with sector attributes in targets.json.

src/mbed_tools/build/_internal/config/source.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ def prepare(
4444
namespace = data.pop("name", source_name)
4545
for key in data:
4646
if isinstance(data[key], list):
47-
data[key] = set(data[key])
48-
47+
try:
48+
data[key] = set(data[key])
49+
except TypeError:
50+
data[key] = set(*data[key])
4951
if "config" in data:
5052
data["config"] = _extract_config_settings(namespace, data["config"])
5153

tests/build/_internal/config/test_source.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ def test_converts_config_setting_value_lists_to_sets(self):
109109
lib = {
110110
"name": "library",
111111
"config": {"list-values": {"value": ["ETHERNET", "WIFI"]}},
112+
"sectors": [[0, 2048]],
112113
}
113114

114115
conf = source.prepare(lib)
115116

116117
assert conf["config"][0].value == {"ETHERNET", "WIFI"}
118+
assert conf["sectors"] == {0, 2048}

0 commit comments

Comments
 (0)