Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of OmniWheels by
__init__.py
00001 from os.path import dirname, abspath, join, exists 00002 00003 from tools.utils import json_file_to_dict 00004 from tools.targets import TARGET_MAP 00005 from tools.config import Config 00006 00007 CONFIG_DIR = dirname(abspath(__file__)) 00008 CONFIG_MAP = json_file_to_dict(join(CONFIG_DIR, "config_paths.json")) 00009 TARGET_CONFIGS = json_file_to_dict(join(CONFIG_DIR, "target_configs.json")) 00010 00011 def get_valid_configs(target_name): 00012 if target_name in TARGET_CONFIGS: 00013 target_config = TARGET_CONFIGS[target_name] 00014 elif (target_name in TARGET_MAP and 'LWIP' in TARGET_MAP[target_name].features): 00015 target_config = { "default_test_configuration": "ETHERNET", "test_configurations": ["ETHERNET"] } 00016 else: 00017 return {} 00018 00019 config_dict = {} 00020 for attr in CONFIG_MAP: 00021 if attr in target_config['test_configurations']: 00022 config_dict[attr] = CONFIG_MAP[attr] 00023 return config_dict 00024 00025 def get_config_path(conf_name, target_name): 00026 configs = get_valid_configs(target_name) 00027 if configs and conf_name.upper() in configs: 00028 return join(CONFIG_DIR, configs[conf_name.upper()]) 00029 else: 00030 return None 00031 00032 def get_default_config(source_dir, target_name): 00033 if target_name in TARGET_CONFIGS: 00034 config_name = TARGET_CONFIGS[target_name]['default_test_configuration'] 00035 if config_name == "NONE": 00036 return None 00037 return join(CONFIG_DIR, CONFIG_MAP[config_name]) 00038 elif Config.find_app_config(source_dir): 00039 return None 00040 elif (target_name in TARGET_MAP and 'LWIP' in TARGET_MAP[target_name].features): 00041 return join(CONFIG_DIR, CONFIG_MAP["ETHERNET"]) 00042 else: 00043 return None
Generated on Fri Jul 22 2022 04:53:42 by
1.7.2
