mirror of https://github.com/ARMmbed/mbed-os.git
Update custom target handling
Accounts for the Config object owning a target, and TARGET_MAP not being a modify-able dict.pull/2852/head
parent
39fa771d92
commit
f41fc43aed
|
@ -20,7 +20,7 @@ import os
|
||||||
# Implementation of mbed configuration mechanism
|
# Implementation of mbed configuration mechanism
|
||||||
from tools.utils import json_file_to_dict
|
from tools.utils import json_file_to_dict
|
||||||
from tools.targets import CUMULATIVE_ATTRIBUTES, TARGET_MAP, \
|
from tools.targets import CUMULATIVE_ATTRIBUTES, TARGET_MAP, \
|
||||||
generate_py_target, get_resolution_order
|
generate_py_target, get_resolution_order, Target
|
||||||
|
|
||||||
# Base class for all configuration exceptions
|
# Base class for all configuration exceptions
|
||||||
class ConfigException(Exception):
|
class ConfigException(Exception):
|
||||||
|
|
|
@ -266,16 +266,9 @@ class Target(namedtuple("Target", "name json_data resolution_order resolution_or
|
||||||
in 'new_targets'. It is an error to add a target with a name that
|
in 'new_targets'. It is an error to add a target with a name that
|
||||||
already exists.
|
already exists.
|
||||||
"""
|
"""
|
||||||
crt_data = Target.get_json_target_data()
|
|
||||||
for target_key, target_value in new_targets.items():
|
for target_key, target_value in new_targets.items():
|
||||||
if crt_data.has_key(target_key):
|
|
||||||
raise Exception(
|
|
||||||
"Attempt to add target '%s' that already exists"
|
|
||||||
% target_key)
|
|
||||||
# Add target data to the internal target dictionary
|
|
||||||
crt_data[target_key] = target_value
|
|
||||||
# Create the new target and add it to the relevant data structures
|
# Create the new target and add it to the relevant data structures
|
||||||
new_target = Target(target_key)
|
new_target = generate_py_target(new_targets, target_key)
|
||||||
TARGETS.append(new_target)
|
TARGETS.append(new_target)
|
||||||
TARGET_MAP[target_key] = new_target
|
TARGET_MAP[target_key] = new_target
|
||||||
TARGET_NAMES.append(target_key)
|
TARGET_NAMES.append(target_key)
|
||||||
|
|
Loading…
Reference in New Issue