Skip to content

Commit f41fc43

Browse files
committed
Update custom target handling
Accounts for the Config object owning a target, and TARGET_MAP not being a modify-able dict.
1 parent 39fa771 commit f41fc43

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

tools/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Implementation of mbed configuration mechanism
2121
from tools.utils import json_file_to_dict
2222
from tools.targets import CUMULATIVE_ATTRIBUTES, TARGET_MAP, \
23-
generate_py_target, get_resolution_order
23+
generate_py_target, get_resolution_order, Target
2424

2525
# Base class for all configuration exceptions
2626
class ConfigException(Exception):

tools/targets.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,16 +266,9 @@ def add_py_targets(new_targets):
266266
in 'new_targets'. It is an error to add a target with a name that
267267
already exists.
268268
"""
269-
crt_data = Target.get_json_target_data()
270269
for target_key, target_value in new_targets.items():
271-
if crt_data.has_key(target_key):
272-
raise Exception(
273-
"Attempt to add target '%s' that already exists"
274-
% target_key)
275-
# Add target data to the internal target dictionary
276-
crt_data[target_key] = target_value
277270
# Create the new target and add it to the relevant data structures
278-
new_target = Target(target_key)
271+
new_target = generate_py_target(new_targets, target_key)
279272
TARGETS.append(new_target)
280273
TARGET_MAP[target_key] = new_target
281274
TARGET_NAMES.append(target_key)

0 commit comments

Comments
 (0)