def get_mbed_targets_from_yotta(mbed_classic_name): """! Function is using 'yotta search' command to fetch matching mbed device target's name @return Function returns list of possible targets or empty list if value not found @details Example: $ yt search -k mbed-target:k64f target frdm-k64f-gcc 0.0.16: Official mbed build target for the mbed frdm-k64f development board. frdm-k64f-armcc 0.0.10: Official mbed build target for the mbed frdm-k64f development board, using the armcc toolchain. Note: Function prints on console """ result = [] cmd = ['yotta', '--plain', 'search', '-k', 'mbed-target:%s'% mbed_classic_name.lower().strip(), 'target'] gt_logger.gt_log("yotta search for mbed-target '%s'"% gt_logger.gt_bright(mbed_classic_name.lower().strip())) gt_logger.gt_log_tab("calling yotta: %s"% " ".join(cmd)) _stdout, _stderr, _ret = run_cli_process(cmd) if not _ret: for line in _stdout.splitlines(): yotta_target_name = parse_yotta_search_cmd_output(line) if yotta_target_name: if yotta_target_name and yotta_target_name not in result: result.append(yotta_target_name) gt_logger.gt_log_tab("found target '%s'" % gt_logger.gt_bright(yotta_target_name)) else: gt_logger.gt_log_err("calling yotta search failed!") return result
def get_mbed_target_call_yotta_target(): """! Calls yotta's 'yotta target' command to get information about """ cmd = ['yotta', '--plain', 'target'] gt_logger.gt_log("checking yotta target in current directory") gt_logger.gt_log_tab("calling yotta: %s"% " ".join(cmd)) _stdout, _stderr, _ret = run_cli_process(cmd) return _stdout, _stderr, _ret