Exemplo n.º 1
0
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_log("yotta search for mbed-target '%s'" %
           gt_bright(mbed_classic_name.lower().strip()))
    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:
                result.append(yotta_target_name)
                gt_log_tab("found target '%s'" % gt_bright(yotta_target_name))
    else:
        gt_log_err("calling yotta search failed!")
    return result
Exemplo n.º 2
0
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_log("yotta search for mbed-target '%s'"% gt_bright(mbed_classic_name.lower().strip()))
    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_log_tab("found target '%s'" % gt_bright(yotta_target_name))
    else:
        gt_log_err("calling yotta search failed!")
    return result
Exemplo n.º 3
0
def get_mbed_target_from_current_dir():
    """! Function uses yotta target command to check current target

    @return Returns current target or None if target not found (e.g. not yotta package)
    """
    result = None
    cmd = ['yotta', 'target']
    print "mbedgt: yotta search for existing mbed-target"
    _stdout, _stderr, _ret = run_cli_process(cmd)
    if not _ret:
        for line in _stdout.splitlines():
            if ',' in line:
                result = line
                break
    return result
Exemplo n.º 4
0
def get_mbed_target_from_current_dir():
    """! Function uses yotta target command to check current target
    @return Returns current target or None if target not found (e.g. not yotta package)
    """
    result = None
    cmd = ['yotta', '--plain', 'target']
    gt_log("checking yotta target in current directory")
    gt_log_tab("calling yotta: %s"% " ".join(cmd))
    _stdout, _stderr, _ret = run_cli_process(cmd)
    if not _ret:
        for line in _stdout.splitlines():
            target = parse_yotta_target_cmd_output(line)
            if target:
                result = target
                break
    return result
Exemplo n.º 5
0
def get_mbed_target_from_current_dir():
    """! Function uses yotta target command to check current target
    @return Returns current target or None if target not found (e.g. not yotta package)
    """
    result = None
    cmd = ['yotta', 'target']
    gt_log("checking yotta target in current directory")
    gt_log_tab("calling yotta: %s"% " ".join(cmd))
    _stdout, _stderr, _ret = run_cli_process(cmd)
    if not _ret:
        for line in _stdout.splitlines():
            m = re.search(' \d+\.\d+\.\d+$', line)
            if m and len(m.group()):
                result = line.split()[0]
                break
    return result
Exemplo n.º 6
0
def get_mbed_target_from_current_dir():
    """! Function uses yotta target command to check current target
    @return Returns current target or None if target not found (e.g. not yotta package)
    """
    result = None
    cmd = ['yotta', '--plain', 'target']
    gt_log("checking yotta target in current directory")
    gt_log_tab("calling yotta: %s" % " ".join(cmd))
    _stdout, _stderr, _ret = run_cli_process(cmd)
    if not _ret:
        for line in _stdout.splitlines():
            target = parse_yotta_target_cmd_output(line)
            if target:
                result = target
                break
    return result
Exemplo n.º 7
0
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', 'search', '-k', 'mbed-target:%s' % mbed_classic_name.lower().strip(), 'target']
    print "mbedgt: yotta search for mbed-target:%s" % mbed_classic_name.lower().strip()
    _stdout, _stderr, _ret = run_cli_process(cmd)
    if not _ret:
        for line in _stdout.splitlines():
            m = re.search('([\w\d-]+) \d+\.\d+\.\d+:', line)
            if m and len(m.groups()):
                yotta_target_name = m.groups()[0]
                result.append(yotta_target_name)
                print "\tfound target '%s'" % yotta_target_name
    return result
Exemplo n.º 8
0
def get_mbed_target_call_yotta_target():
    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
Exemplo n.º 9
0
def get_mbed_target_call_yotta_target():
    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
Exemplo n.º 10
0
    """! Function uses yotta target command to check current target
    @return Returns current target or None if target not found (e.g. not yotta package)
    """
    result = None
<<<<<<< HEAD
    cmd = ['yotta', '--plain', 'target']
    gt_log("checking yotta target in current directory")
    gt_log_tab("calling yotta: %s"% " ".join(cmd))
=======
    cmd = ['yotta', 'target']
    print "mbedgt: yotta search for existing mbed-target"
<<<<<<< HEAD
>>>>>>> princeofdarkness76/testing
=======
>>>>>>> origin/testing
    _stdout, _stderr, _ret = run_cli_process(cmd)
    if not _ret:
        for line in _stdout.splitlines():
            target = parse_yotta_target_cmd_output(line)
            if target:
                result = target
                break
    return result

def parse_yotta_target_cmd_output(line):
    # Example targets:
    # $ yt target
    # frdm-k64f-gcc 0.1.3
    # mbed-gcc 0.1.1
    m = re.search(r'[\w\d_-]+ \d+\.\d+\.\d+', line)
    if m and len(m.group()):