Ejemplo n.º 1
0
def install_arduino_sdk(user_io):
    ''' Install Arduino SDK in user biicode_env folder '''
    sdks = find_arduino_sdks()
    if sdks:
        print_sdks(user_io.out, sdks)

    versions = [version for _, version in sdks]
    if CURRENT_VERSION not in versions:
        request_message = 'Arduino SDK %s not detected. Install it?' % CURRENT_VERSION
        if user_io.request_boolean(request_message, True):
            _install_arduino_sdk(user_io)
            sdks = find_arduino_sdks()
            if sdks:
                print_sdks(user_io.out, sdks)
Ejemplo n.º 2
0
def get_valid_sdks(user_io, arduino_settings):
    sdks = find_arduino_sdks()
    if not sdks:
        user_io.out.warn("Biicode couldn't find a default Arduino SDK path")

    filtered_sdks = []
    for (sdk_path, version) in sdks:
        if " " in sdk_path:
            user_io.out.warn("Detected SDK(%s) in %s\nbut paths with spaces are not valid.\n"
                             "Please install it in another location" % (version, sdk_path))
        else:
            filtered_sdks.append((sdk_path, version))
    sdks = filtered_sdks

    print_sdks(user_io.out, sdks)

    if arduino_settings.sdk:
        default_sdk = arduino_settings.sdk
    else:
        default_sdk = None
        for path, version in sdks:
            if version == "1.0.6":
                default_sdk = path
                break
    return sdks, default_sdk
Ejemplo n.º 3
0
def get_valid_sdks(user_io, arduino_settings):
    sdks = find_arduino_sdks()
    if not sdks:
        user_io.out.warn("Biicode couldn't find a default Arduino SDK path")

    filtered_sdks = []
    for (sdk_path, version) in sdks:
        if " " in sdk_path:
            user_io.out.warn(
                "Detected SDK(%s) in %s\nbut paths with spaces are not valid.\n"
                "Please install it in another location" % (version, sdk_path))
        else:
            filtered_sdks.append((sdk_path, version))
    sdks = filtered_sdks

    print_sdks(user_io.out, sdks)

    if arduino_settings.sdk:
        default_sdk = arduino_settings.sdk
    else:
        default_sdk = None
        for path, version in sdks:
            if version == "1.0.6":
                default_sdk = path
                break
    return sdks, default_sdk
Ejemplo n.º 4
0
 def test_get_all_paths(self):
     sdks = find_arduino_sdks()
     output = BiiOutputStream()
     print_sdks(output, sdks)
     self.assert_in_output("version=1.0.6", output)
     self.assert_in_output("version=1.5.8", output)
Ejemplo n.º 5
0
 def test_get_all_paths(self):
     sdks = find_arduino_sdks()
     output = BiiOutputStream()
     print_sdks(output, sdks)
     self.assert_in_output("version=1.0.6", output)
     self.assert_in_output("version=1.5.8", output)