From f41fc43aed458c69631a163868ffd8b48227f8b3 Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 1 Sep 2016 15:44:36 -0500 Subject: [PATCH] Update custom target handling Accounts for the Config object owning a target, and TARGET_MAP not being a modify-able dict. --- tools/config.py | 2 +- tools/targets.py | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/tools/config.py b/tools/config.py index 76c38c43e4f..06d8e3afa6a 100644 --- a/tools/config.py +++ b/tools/config.py @@ -20,7 +20,7 @@ # Implementation of mbed configuration mechanism from tools.utils import json_file_to_dict 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 class ConfigException(Exception): diff --git a/tools/targets.py b/tools/targets.py index 927dfd6699c..62d2c24c9a7 100644 --- a/tools/targets.py +++ b/tools/targets.py @@ -266,16 +266,9 @@ def add_py_targets(new_targets): in 'new_targets'. It is an error to add a target with a name that already exists. """ - crt_data = Target.get_json_target_data() 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 - new_target = Target(target_key) + new_target = generate_py_target(new_targets, target_key) TARGETS.append(new_target) TARGET_MAP[target_key] = new_target TARGET_NAMES.append(target_key)